[next] fix: preserve jsx for rolldown/vite8 dep scan#252
[next] fix: preserve jsx for rolldown/vite8 dep scan#252birkskyum merged 1 commit intosolidjs:nextfrom
Conversation
🦋 Changeset detectedLatest commit: e6bcd30 The changes in this PR will be included in the next version bump. 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 |
commit: |
There was a problem hiding this comment.
Pull request overview
This PR addresses a Vite 8 dependency-scanning regression for Solid TSX projects by ensuring Rolldown preserves JSX during optimize-deps scanning, avoiding unintended React JSX runtime injection.
Changes:
- Introduce
viteVersionMajorparsing and add anisVite8runtime gate. - For Vite 8+, set
optimizeDeps.rolldownOptions.transform.jsx = 'preserve'during config generation. - Add a patch changeset documenting the fix.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/index.ts | Adds a Vite 8+ optimize-deps configuration to preserve JSX during Rolldown dependency scanning. |
| .changeset/six-lions-joke.md | Publishes a patch changeset describing the dependency-scan JSX preservation fix. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // Vite 8+ uses Rolldown for dependency scanning. Rolldown defaults to | ||
| // React's automatic JSX runtime for .tsx files, injecting a | ||
| // react/jsx-dev-runtime import. Tell it to preserve JSX as-is since | ||
| // this plugin handles JSX transformation via babel-preset-solid. | ||
| ...(isVite8 | ||
| ? { rolldownOptions: { transform: { jsx: 'preserve' as const } } } | ||
| : {}), |
There was a problem hiding this comment.
The new Vite 8+ code path (adding optimizeDeps.rolldownOptions.transform.jsx = 'preserve') isn’t covered by the repo’s integration test runner: scripts/test-examples.ts currently only tests examples up to vite-6, even though examples/vite-8 exists. Please add vite-8 (and ideally vite-7) to the example test matrix or add a targeted regression test that exercises the Rolldown dep-scan behavior so this doesn’t regress silently.
Closes vitejs/vite#22057
Same as
Repro without this patch
Branch
Stackblitz
Repro with this patch
Branch
Stackblitz