File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ ---
2+ ' vite-plugin-solid ' : patch
3+ ---
4+
5+ fix: preserve jsx for rolldown dep scan
Original file line number Diff line number Diff line change @@ -18,7 +18,9 @@ const runtimePublicPath = '/@solid-refresh';
1818const runtimeFilePath = require . resolve ( 'solid-refresh/dist/solid-refresh.mjs' ) ;
1919const runtimeCode = readFileSync ( runtimeFilePath , 'utf-8' ) ;
2020
21- const isVite6 = + version . split ( '.' ) [ 0 ] >= 6 ;
21+ const viteVersionMajor = + version . split ( '.' ) [ 0 ] ;
22+ const isVite6 = viteVersionMajor >= 6 ;
23+ const isVite8 = viteVersionMajor >= 8 ;
2224
2325const VIRTUAL_MANIFEST_ID = 'virtual:solid-manifest' ;
2426const RESOLVED_VIRTUAL_MANIFEST_ID = '\0' + VIRTUAL_MANIFEST_ID ;
@@ -307,6 +309,13 @@ export default function solidPlugin(options: Partial<Options> = {}): Plugin {
307309 optimizeDeps : {
308310 include : [ ...nestedDeps , ...solidPkgsConfig . optimizeDeps . include ] ,
309311 exclude : solidPkgsConfig . optimizeDeps . exclude ,
312+ // Vite 8+ uses Rolldown for dependency scanning. Rolldown defaults to
313+ // React's automatic JSX runtime for .tsx files, injecting a
314+ // react/jsx-dev-runtime import. Tell it to preserve JSX as-is since
315+ // this plugin handles JSX transformation via babel-preset-solid.
316+ ...( isVite8
317+ ? { rolldownOptions : { transform : { jsx : 'preserve' as const } } }
318+ : { } ) ,
310319 } ,
311320 ...( ! isVite6 ? { ssr : solidPkgsConfig . ssr } : { } ) ,
312321 ...( test . server ? { test } : { } ) ,
You can’t perform that action at this time.
0 commit comments