Skip to content

[next] fix: preserve jsx for rolldown/vite8 dep scan#252

Merged
birkskyum merged 1 commit intosolidjs:nextfrom
birkskyum:rolldown-dep-scan-next
Apr 5, 2026
Merged

[next] fix: preserve jsx for rolldown/vite8 dep scan#252
birkskyum merged 1 commit intosolidjs:nextfrom
birkskyum:rolldown-dep-scan-next

Conversation

@birkskyum
Copy link
Copy Markdown
Member

@birkskyum birkskyum commented Apr 3, 2026

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Apr 3, 2026

🦋 Changeset detected

Latest 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

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Apr 3, 2026

Open in StackBlitz

npm i https://pkg.pr.new/vite-plugin-solid@252

commit: e6bcd30

@birkskyum birkskyum changed the title [next] fix: preserve jsx for rolldown dep scan [next] fix: preserve jsx for rolldown/vite8 dep scan Apr 3, 2026
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 viteVersionMajor parsing and add an isVite8 runtime 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.

Comment on lines +312 to +318
// 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 } } }
: {}),
Copy link

Copilot AI Apr 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
@birkskyum birkskyum merged commit 5ffcb1e into solidjs:next Apr 5, 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.

2 participants