rolldown: [Bug]: Remix support
Discussed in https://github.com/rolldown/rolldown/discussions/3868
<div type='discussions-op-text'>Originally posted by zaaack March 16, 2025 Add these config cause remix project broken,
esbuild: false,
experimental: {
enableNativePlugin: true,
},
error log
$ pnpm build
server@ build /home/z/my-remix-starter remix vite:build
vite v6.2.1 building for production… The built-in minifier is still under development. Setting “minify: true” is not recommended for production use. ✓ 66 modules transformed. ✗ Build failed in 193ms Build failed with 3 errors: [plugin remix] /home/z/my-remix-starter/app/root.tsx?remix-build-client-route:25:8 Error: Failed to parse source for import analysis because the content contains invalid JS syntax. If you use tsconfig.json, make sure to not set jsx to preserve. 23 | <ScrollRestoration /> 24 | <Scripts /> 25 | </> | ^ 26 | ); 27 | // return ( at TransformPluginContext.formatLog (file:///home/z/my-remix-starter/node_modules/.pnpm/vite@https+++pkg.pr.new+vitejs+rolldown-vite+vite@c90496e@types+node@22.13.10_esbuild@0.17.6_fxj4mtsvfzgibfkolutqnhel5y/node_modules/vite/dist/node/chunks/dep-D3pz0UHr.js:45999:41) at TransformPluginContext.error (file:///home/z/my-remix-starter/node_modules/.pnpm/vite@https+++pkg.pr.new+vitejs+rolldown-vite+vite@c90496e@types+node@22.13.10_esbuild@0.17.6_fxj4mtsvfzgibfkolutqnhel5y/node_modules/vite/dist/node/chunks/dep-D3pz0UHr.js:45996:16) at TransformPluginContext.transform (file:///home/z/my-remix-starter/node_modules/.pnpm/vite@https+++pkg.pr.new+vitejs+rolldown-vite+vite@c90496e@types+node@22.13.10_esbuild@0.17.6_fxj4mtsvfzgibfkolutqnhel5y/node_modules/vite/dist/node/chunks/dep-D3pz0UHr.js:43898:14) at EnvironmentPluginContainer.transform (file:///home/z/my-remix-starter/node_modules/.pnpm/vite@https+++pkg.pr.new+vitejs+rolldown-vite+vite@c90496e_@types+node@22.13.10_esbuild@0.17.6_fxj4mtsvfzgibfkolutqnhel5y/node_modules/vite/dist/node/chunks/dep-D3pz0UHr.js:45786:18) at getRouteModuleExports (/home/z/my-remix-starter/node_modules/.pnpm/@remix-run+dev@2.16.0_@remix-run+react@2.16.0_react-dom@19.0.0_react@19.0.0__react@19.0.0_typ_nqmrhs457ahbljv2gtrangiacq/node_modules/@remix-run/dev/dist/vite/plugin.js:235:21) at TransformPluginContextImpl.transform (/home/z/my-remix-starter/node_modules/.pnpm/@remix-run+dev@2.16.0_@remix-run+react@2.16.0_react-dom@19.0.0_react@19.0.0__react@19.0.0_typ_nqmrhs457ahbljv2gtrangiacq/node_modules/@remix-run/dev/dist/vite/plugin.js:798:29) at plugin (file:///home/z/my-remix-starter/node_modules/.pnpm/rolldown@1.0.0-beta.3-commit.e170e6e_@oxc-project+runtime@0.56.5_typescript@5.6.3/node_modules/rolldown/dist/shared/src-CTS_IQ3m.mjs:1395:16) at plugin.<computed> (file:///home/z/my-remix-starter/node_modules/.pnpm/rolldown@1.0.0-beta.3-commit.e170e6e_@oxc-project+runtime@0.56.5_typescript@5.6.3/node_modules/rolldown/dist/shared/src-CTS_IQ3m.mjs:1923:12) [plugin remix] /home/z/my-remix-starter/app/routes/admin.$/route.tsx?remix-build-client-route:17:42 Error: Failed to parse source for import analysis because the content contains invalid JS syntax. If you use tsconfig.json, make sure to not set jsx to preserve. 15 | },[]) 16 | return ( 17 | <div id=“admin-root”>Loading…</div> | ^ 18 | ); 19 | } at TransformPluginContext.formatLog (file:///home/z/my-remix-starter/node_modules/.pnpm/vite@https+++pkg.pr.new+vitejs+rolldown-vite+vite@c90496e@types+node@22.13.10_esbuild@0.17.6_fxj4mtsvfzgibfkolutqnhel5y/node_modules/vite/dist/node/chunks/dep-D3pz0UHr.js:45999:41) at TransformPluginContext.error (file:///home/z/my-remix-starter/node_modules/.pnpm/vite@https+++pkg.pr.new+vitejs+rolldown-vite+vite@c90496e@types+node@22.13.10_esbuild@0.17.6_fxj4mtsvfzgibfkolutqnhel5y/node_modules/vite/dist/node/chunks/dep-D3pz0UHr.js:45996:16) at TransformPluginContext.transform (file:///home/z/my-remix-starter/node_modules/.pnpm/vite@https+++pkg.pr.new+vitejs+rolldown-vite+vite@c90496e@types+node@22.13.10_esbuild@0.17.6_fxj4mtsvfzgibfkolutqnhel5y/node_modules/vite/dist/node/chunks/dep-D3pz0UHr.js:43898:14) at EnvironmentPluginContainer.transform (file:///home/z/my-remix-starter/node_modules/.pnpm/vite@https+++pkg.pr.new+vitejs+rolldown-vite+vite@c90496e_@types+node@22.13.10_esbuild@0.17.6_fxj4mtsvfzgibfkolutqnhel5y/node_modules/vite/dist/node/chunks/dep-D3pz0UHr.js:45786:18) at getRouteModuleExports (/home/z/my-remix-starter/node_modules/.pnpm/@remix-run+dev@2.16.0_@remix-run+react@2.16.0_react-dom@19.0.0_react@19.0.0__react@19.0.0_typ_nqmrhs457ahbljv2gtrangiacq/node_modules/@remix-run/dev/dist/vite/plugin.js:235:21) at TransformPluginContextImpl.transform (/home/z/my-remix-starter/node_modules/.pnpm/@remix-run+dev@2.16.0_@remix-run+react@2.16.0_react-dom@19.0.0_react@19.0.0__react@19.0.0_typ_nqmrhs457ahbljv2gtrangiacq/node_modules/@remix-run/dev/dist/vite/plugin.js:798:29) at plugin (file:///home/z/my-remix-starter/node_modules/.pnpm/rolldown@1.0.0-beta.3-commit.e170e6e_@oxc-project+runtime@0.56.5_typescript@5.6.3/node_modules/rolldown/dist/shared/src-CTS_IQ3m.mjs:1395:16) at plugin.<computed> (file:///home/z/my-remix-starter/node_modules/.pnpm/rolldown@1.0.0-beta.3-commit.e170e6e_@oxc-project+runtime@0.56.5_typescript@5.6.3/node_modules/rolldown/dist/shared/src-CTS_IQ3m.mjs:1923:12) [plugin remix] /home/z/my-remix-starter/app/routes/index/route.tsx?remix-build-client-route:13:28 Error: Failed to parse source for import analysis because the content contains invalid JS syntax. If you use tsconfig.json, make sure to not set jsx to preserve. 11 | return ( 12 | <div> 13 | <h1>Hello World!</h1> | ^ 14 | </div> 15 | ); at TransformPluginContext.formatLog (file:///home/z/my-remix-starter/node_modules/.pnpm/vite@https+++pkg.pr.new+vitejs+rolldown-vite+vite@c90496e@types+node@22.13.10_esbuild@0.17.6_fxj4mtsvfzgibfkolutqnhel5y/node_modules/vite/dist/node/chunks/dep-D3pz0UHr.js:45999:41) at TransformPluginContext.error (file:///home/z/my-remix-starter/node_modules/.pnpm/vite@https+++pkg.pr.new+vitejs+rolldown-vite+vite@c90496e@types+node@22.13.10_esbuild@0.17.6_fxj4mtsvfzgibfkolutqnhel5y/node_modules/vite/dist/node/chunks/dep-D3pz0UHr.js:45996:16) at TransformPluginContext.transform (file:///home/z/my-remix-starter/node_modules/.pnpm/vite@https+++pkg.pr.new+vitejs+rolldown-vite+vite@c90496e@types+node@22.13.10_esbuild@0.17.6_fxj4mtsvfzgibfkolutqnhel5y/node_modules/vite/dist/node/chunks/dep-D3pz0UHr.js:43898:14) at EnvironmentPluginContainer.transform (file:///home/z/my-remix-starter/node_modules/.pnpm/vite@https+++pkg.pr.new+vitejs+rolldown-vite+vite@c90496e@types+node@22.13.10_esbuild@0.17.6_fxj4mtsvfzgibfkolutqnhel5y/node_modules/vite/dist/node/chunks/dep-D3pz0UHr.js:45786:18) at getRouteModuleExports (/home/z/my-remix-starter/node_modules/.pnpm/@remix-run+dev@2.16.0_@remix-run+react@2.16.0_react-dom@19.0.0_react@19.0.0__react@19.0.0_typ_nqmrhs457ahbljv2gtrangiacq/node_modules/@remix-run/dev/dist/vite/plugin.js:235:21) at TransformPluginContextImpl.transform (/home/z/my-remix-starter/node_modules/.pnpm/@remix-run+dev@2.16.0_@remix-run+react@2.16.0_react-dom@19.0.0_react@19.0.0__react@19.0.0_typ_nqmrhs457ahbljv2gtrangiacq/node_modules/@remix-run/dev/dist/vite/plugin.js:798:29) at plugin (file:///home/z/my-remix-starter/node_modules/.pnpm/rolldown@1.0.0-beta.3-commit.e170e6e_@oxc-project+runtime@0.56.5_typescript@5.6.3/node_modules/rolldown/dist/shared/src-CTS_IQ3m.mjs:1395:16) at plugin.<computed> (file:///home/z/my-remix-starter/node_modules/.pnpm/rolldown@1.0.0-beta.3-commit.e170e6e_@oxc-project+runtime@0.56.5_typescript@5.6.3/node_modules/rolldown/dist/shared/src-CTS_IQ3m.mjs:1923:12)
at normalizeErrors (file:///home/z/my-remix-starter/node_modules/.pnpm/rolldown@1.0.0-beta.3-commit.e170e6e_@oxc-project+runtime@0.56.5_typescript@5.6.3/node_modules/rolldown/dist/shared/src-CTS_IQ3m.mjs:807:18)
at handleOutputErrors (file:///home/z/my-remix-starter/node_modules/.pnpm/rolldown@1.0.0-beta.3-commit.e170e6e_@oxc-project+runtime@0.56.5_typescript@5.6.3/node_modules/rolldown/dist/shared/src-CTS_IQ3m.mjs:995:34)
at transformToRollupOutput (file:///home/z/my-remix-starter/node_modules/.pnpm/rolldown@1.0.0-beta.3-commit.e170e6e_@oxc-project+runtime@0.56.5_typescript@5.6.3/node_modules/rolldown/dist/shared/src-CTS_IQ3m.mjs:989:2)
at RolldownBuild.write (file:///home/z/my-remix-starter/node_modules/.pnpm/rolldown@1.0.0-beta.3-commit.e170e6e_@oxc-project+runtime@0.56.5_typescript@5.6.3/node_modules/rolldown/dist/shared/src-CTS_IQ3m.mjs:2655:10)
at buildEnvironment (file:///home/z/my-remix-starter/node_modules/.pnpm/vite@https+++pkg.pr.new+vitejs+rolldown-vite+vite@c90496e_@types+node@22.13.10_esbuild@0.17.6_fxj4mtsvfzgibfkolutqnhel5y/node_modules/vite/dist/node/chunks/dep-D3pz0UHr.js:49712:16)
at viteBuild (/home/z/my-remix-starter/node_modules/.pnpm/@remix-run+dev@2.16.0_@remix-run+react@2.16.0_react-dom@19.0.0_react@19.0.0__react@19.0.0_typ_nqmrhs457ahbljv2gtrangiacq/node_modules/@remix-run/dev/dist/vite/build.js:212:5)
at build (/home/z/my-remix-starter/node_modules/.pnpm/@remix-run+dev@2.16.0_@remix-run+react@2.16.0_react-dom@19.0.0_react@19.0.0__react@19.0.0_typ_nqmrhs457ahbljv2gtrangiacq/node_modules/@remix-run/dev/dist/vite/build.js:236:3)
at Object.viteBuild (/home/z/my-remix-starter/node_modules/.pnpm/@remix-run+dev@2.16.0_@remix-run+react@2.16.0_react-dom@19.0.0_react@19.0.0__react@19.0.0_typ_nqmrhs457ahbljv2gtrangiacq/node_modules/@remix-run/dev/dist/cli/commands.js:184:5)
at Object.run (/home/z/my-remix-starter/node_modules/.pnpm/@remix-run+dev@2.16.0_@remix-run+react@2.16.0_react-dom@19.0.0_react@19.0.0__react@19.0.0_typ_nqmrhs457ahbljv2gtrangiacq/node_modules/@remix-run/dev/dist/cli/run.js:252:7) {
errors: [Getter/Setter] } ELIFECYCLE Command failed with exit code 1.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 3
- Comments: 36 (24 by maintainers)
Commits related to this issue
- refactor(rolldown_plugin_transform): improve code style and align `filter` logic with `Vite` (#3931) ### Description Related to #3881 The main focus was on improving the code style and aligning the... — committed to rolldown/rolldown by shulaoda 2 years ago
- fix(rolldown_transform_plugin): incorrect detection of file extension (#4241) ### Description Related to #3881 The bug exposed when solving this issue. — committed to rolldown/rolldown by shulaoda 2 years ago
Related to https://github.com/vitejs/rolldown-vite/issues/100#issuecomment-2774442401
We need to make native plugins runnable within the
pluginContaineron theNodeside, which might take some time to implement. Without enabling native plugins, this issue should not be encountered.For the remix performance issue, it may due to https://github.com/remix-run/remix/blob/main/packages/remix-dev/vite/plugin.ts#L8
Ok, so let 's use option two, align with https://github.com/vitejs/rolldown-vite/blob/fa33494473d41956fa16ae441d9a4be98bd192d0/packages/vite/src/node/plugins/oxc.ts?plain=1#L297-L396
Due to potential processor-related issues, the results may not be entirely accurate. Currently,
nativeTransformPluginis faster thanoxcPluginagain.Here is the result on my computer after remove
vite-react-plugin,[info] vite: 3.75s [info] viteNativePlugin: 1.55s [info] esbuild: 0.88s [info] rsbuild: 3.20s
Interesting,
You don’t need react plugin anymore if you use
rolldown-viteI have measured the differences between
nativeTransformPluginandoxcPluginas follows (need to hack internal logic):If we only look at
nativeTransformPlugin, perhaps we should test it this way? Are we only replacingnativeTransformPluginwithoxcPluginas mentioned above?