Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/six-lions-joke.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'vite-plugin-solid': patch
---

fix: preserve jsx for rolldown dep scan
11 changes: 10 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ const runtimePublicPath = '/@solid-refresh';
const runtimeFilePath = require.resolve('solid-refresh/dist/solid-refresh.mjs');
const runtimeCode = readFileSync(runtimeFilePath, 'utf-8');

const isVite6 = +version.split('.')[0] >= 6;
const viteVersionMajor = +version.split('.')[0];
const isVite6 = viteVersionMajor >= 6;
const isVite8 = viteVersionMajor >= 8;

const VIRTUAL_MANIFEST_ID = 'virtual:solid-manifest';
const RESOLVED_VIRTUAL_MANIFEST_ID = '\0' + VIRTUAL_MANIFEST_ID;
Expand Down Expand Up @@ -307,6 +309,13 @@ export default function solidPlugin(options: Partial<Options> = {}): Plugin {
optimizeDeps: {
include: [...nestedDeps, ...solidPkgsConfig.optimizeDeps.include],
exclude: solidPkgsConfig.optimizeDeps.exclude,
// 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 } } }
: {}),
Comment on lines +312 to +318
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.
},
...(!isVite6 ? { ssr: solidPkgsConfig.ssr } : {}),
...(test.server ? { test } : {}),
Expand Down
Loading