Skip to content

solid: compile JSX in node_modules again - #2051

Merged
simonklee merged 1 commit into
mainfrom
solid-node-modules-jsx
Nov 12, 2026
Merged

simonklee merged 1 commit into
mainfrom
solid-node-modules-jsx

Conversation

@kommander

Copy link
Copy Markdown
Collaborator

Since 10dd994 (in #1149, v0.4.0) the Solid transform skips every file under node_modules. Runtime plugins installed from a registry live there and often ship TSX, so their JSX falls through to Bun's generic transform. Props are no longer reactive, <Show>/<Match> children are built eagerly, and a key prop is dropped. Nothing warns.

This broke OpenCode TUI plugins installed from npm or git. OpenCode's own docs publish "./tui": "./src/tui.tsx". In opencode-claude-suite, opening its accounts dialog also built the hidden sign-in screen, which ran claude auth login and opened the browser. The dialog never updated and ignored every key. OpenCode first shipped OpenTUI 0.4 on 2026-07-06. Before that, the filter was /\.(js|ts)x/ and compiled these files. Some plugins work around the regression: magic-context precompiles its TUI and says why in src/tui/entry.mjs.

JSX is compiled wherever it lives again. Plain JS and TS in node_modules stay excluded, because routing CJS through onLoad breaks its interop (see the note in runtime-plugin.ts). The runtime plugin and the preload share the same filter (ensureSolidTransformPlugin creates the plugin without resolvePath), so the preload also compiles node_modules JSX again, as it did before 0.4.0.

The node_modules fixture now loads a TSX module from the installed package. Its <Show when={false}> child must not run. Before this fix the module fails to load, because Bun's generic transform imports @opentui/solid/jsx-dev-runtime, which the runtime plugin never rewrites. In a host that has its own copy of @opentui/solid installed next to the plugin, it loads instead and renders without reactivity.

Checks: bun test tests/runtime-plugin-support passes (5 tests), and oxfmt and oxlint are clean on the changed files. The full Solid suite fails the same 293 tests with and without this change here. They all come from a stale local libopentui.dylib, because the native build needs Zig 0.17 and this machine has 0.16.

Since 10dd994 the Solid transform skips every file under node_modules.
Runtime plugins installed from a registry live there and ship TSX, so
their JSX fell through to Bun's generic transform: no reactive props,
eager control-flow children and a dropped key prop.

JSX is compiled wherever it lives again. Plain JS and TS in node_modules
stay excluded, because routing CJS through onLoad breaks its interop.
@kommander
kommander requested a review from simonklee as a code owner November 12, 2026 13:32
@simonklee
simonklee enabled auto-merge (squash) November 12, 2026 13:33
@simonklee
simonklee merged commit 5e06c31 into main Nov 12, 2026
21 checks passed
@simonklee
simonklee deleted the solid-node-modules-jsx branch November 12, 2026 13:34
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