Skip to content

fix: apply the dep scanner JSX setting to every environment - #400

Merged
ryansolid merged 2 commits into
nextfrom
fix/issue-387-scan-jsx-all-environments
Oct 8, 2026
Merged

ryansolid merged 2 commits into
nextfrom
fix/issue-387-scan-jsx-all-environments

Conversation

@ryansolid

Copy link
Copy Markdown
Member

Fixes #387.

Problem

The plugin sets the dep scanner's optimizeDeps.rolldownOptions.transform.jsx (classic runtime, #262) in its top-level config hook. Vite 8 only seeds the client environment from top-level optimizeDeps, so other environments scan .tsx with Rolldown's default React automatic runtime. Server environments default to noDiscovery: true, but hosts that run SSR outside Node turn discovery back on (@cloudflare/vite-plugin). In those setups the ssr scan fails on react/jsx-dev-runtime and pre-bundling is skipped.

Fix

configEnvironment now gives every non-client environment the same scanner settings:

  • transform.jsx ??= { runtime: 'classic' }, so an app's own per-environment value still wins;
  • the .tsrx extension;
  • the tsrx scan plugin, hoisted so the top-level config and this branch share it.

Client-only entries (include/exclude) stay top-level.

Tests

New examples/ssr/test/scan.mjs, wired into the example's test script:

  • Resolved config: the ssr environment gets the classic runtime, .tsrx, and the scan plugin, and an app-set per-environment jsx is left alone.
  • Cold dev server: with ssr discovery on (entries: ['src/entry-server.tsx'], whose graph has JSX and import.meta.glob), both the client and ssr scans finish without the failure banner.

On next without the fix, 4/7 checks fail, including the exact react/jsx-dev-runtime (imported by …/Glob.tsx) banner from the issue. With the fix, examples/ssr (run, boundary, scan) and start-ssr dev pass.

Made with Cursor

@changeset-bot

changeset-bot Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: c3a47d5

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@solidjs/vite-plugin Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@pkg-pr-new

pkg-pr-new Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@solidjs/vite-plugin@400

commit: c3a47d5

@ryansolid
ryansolid force-pushed the fix/issue-387-scan-jsx-all-environments branch from 50cad03 to c3a47d5 Compare October 8, 2026 20:16
@ryansolid
ryansolid merged commit ef5537a into next Oct 8, 2026
6 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.

1 participant