Skip to content

Ship compiled JavaScript in Pulse for opencode (0.2.1) - #18

Merged
fatwang2 merged 1 commit into
mainfrom
claude/project-thread-8hfo8k
Nov 3, 2026
Merged

fatwang2 merged 1 commit into
mainfrom
claude/project-thread-8hfo8k

Conversation

@fatwang2

@fatwang2 fatwang2 commented Nov 3, 2026

Copy link
Copy Markdown
Owner

0.2.0 from npm fails to load in opencode v2 with Cannot find package 'react'. v2 compiles a plugin's TSX with Solid only when the file is outside node_modules. For an npm-installed package, Bun falls back to React JSX. Testing from a local checkout hid this, because opencode compiles those files itself.

What changed

  • opencode/scripts/build.mjs compiles src/ to dist/ with Babel, using Solid's universal transform for @opentui/solid (the same transform opencode applies to local plugins). solid-js and @opentui/solid stay as imports, which opencode provides.
  • package.json now exports ./tui as ./dist/tui.js and ships dist/ instead of src/. npm runs the build on prepack, and Babel is a devDependency only.
  • open-source-checks.yml builds the plugin, and release-opencode.yml installs the build tools before publishing.
  • The README and AGENTS.md describe the build step. AGENTS.md also says to test the packed package from a node_modules path. Version bumped to 0.2.1.

Testing

  • make test-opencode passes, and so do npm ci && npm run build from a clean checkout.
  • opencode 2.2.5: put the packed 0.2.1 into opencode's real npm cache path for the plugin and checked that it loads. Checked the sidebar, the bottom band, /pulse-add, /pulse-remove and /pulse-pause (which update right away), and the detail dialog.
  • opencode 1.19.5: loaded the packed 0.2.1 from a node_modules path and checked the sidebar, the band and /pulse-add.

Generated by Claude Code

opencode v2 compiles plugin TSX only outside node_modules, so 0.2.0 from
npm failed to load in v2 ("Cannot find package 'react'"): Bun fell back to
React JSX. Local checkouts worked, which is why testing missed it.

scripts/build.mjs now compiles src/ to dist/ with Solid's universal
transform for @opentui/solid (what opencode applies to local plugins), and
the package exports dist/tui.js. npm runs the build on prepack; CI builds
it, and the release workflow installs the build tools first.

Tested the packed package from node_modules paths in opencode 2.2.5 (the
real npm cache path) and 1.19.5.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DuYf7wf62kLrVeZHzMtocm
@fatwang2
fatwang2 merged commit 5760877 into main Nov 3, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants