Describe the bug
Starting in Vite 8.1.1, the dev server crashes with a parse error on a pre-bundled dependency when @vitejs/plugin-react is used alongside @rolldown/plugin-babel with reactCompilerPreset. Vite 8.1.0 works correctly.
Error
[vite] Internal server error: Failed to parse source for import analysis because the content contains invalid JS syntax. If you are using JSX, make sure to name the file with the .jsx or .tsx extension.
Plugin: vite:import-analysis
File: /.../node_modules/.vite/deps/@tabler_icons-react.js
The error fires repeatedly (×60) on startup, suggesting the pre-bundled output for @tabler/icons-react contains syntax the import-analysis step cannot parse.
Reproduction
vite.config.ts:
import babel from "@rolldown/plugin-babel";
import react, { reactCompilerPreset } from "@vitejs/plugin-react";
import { defineConfig } from "vite";
export default defineConfig({
plugins: [
react(),
babel({ presets: [reactCompilerPreset()] }),
],
});
Any file importing from @tabler/icons-react:
import { IconHome } from "@tabler/icons-react";
Steps to reproduce
- Set up a Vite project with the config above
- Install
@tabler/icons-react, @vitejs/plugin-react@6, @rolldown/[email protected], babel-plugin-react-compiler
- Run
vite dev
- Dev server fails immediately with the error above
Expected behavior
Dev server starts normally (as it does with Vite 8.1.0).
Actual behavior
vite:import-analysis fails to parse the pre-bundled @tabler_icons-react.js output.
Environment
|
|
| Vite |
8.1.1 (works on 8.1.0) |
@vitejs/plugin-react |
6.0.3 |
@rolldown/plugin-babel |
0.2.3 |
babel-plugin-react-compiler |
1.0.0 |
@tabler/icons-react |
3.44.0 |
| Node |
24.x |
| OS |
macOS arm64 |
Workaround
Pin vite to 8.1.0.
Notes
@rolldown/plugin-babel excludes node_modules by default via DEFAULT_EXCLUDE = [/[/\\]node_modules[/\\]/], but reactCompilerPreset uses a code-based filter (/forwardRef|memo|…/) rather than a path filter. @tabler/icons-react uses forwardRef extensively and matches this filter. Suspect something changed in 8.1.1 in how the optimizer environment is configured such that the preset's applyToEnvironmentHook (env.config.consumer === "client") now matches during dep pre-bundling, where it did not in 8.1.0.
Describe the bug
Starting in Vite 8.1.1, the dev server crashes with a parse error on a pre-bundled dependency when
@vitejs/plugin-reactis used alongside@rolldown/plugin-babelwithreactCompilerPreset. Vite 8.1.0 works correctly.Error
The error fires repeatedly (×60) on startup, suggesting the pre-bundled output for
@tabler/icons-reactcontains syntax the import-analysis step cannot parse.Reproduction
vite.config.ts:Any file importing from
@tabler/icons-react:Steps to reproduce
@tabler/icons-react,@vitejs/plugin-react@6,@rolldown/[email protected],babel-plugin-react-compilervite devExpected behavior
Dev server starts normally (as it does with Vite 8.1.0).
Actual behavior
vite:import-analysisfails to parse the pre-bundled@tabler_icons-react.jsoutput.Environment
@vitejs/plugin-react@rolldown/plugin-babelbabel-plugin-react-compiler@tabler/icons-reactWorkaround
Pin
viteto8.1.0.Notes
@rolldown/plugin-babelexcludesnode_modulesby default viaDEFAULT_EXCLUDE = [/[/\\]node_modules[/\\]/], butreactCompilerPresetuses a code-based filter (/forwardRef|memo|…/) rather than a path filter.@tabler/icons-reactusesforwardRefextensively and matches this filter. Suspect something changed in 8.1.1 in how the optimizer environment is configured such that the preset'sapplyToEnvironmentHook(env.config.consumer === "client") now matches during dep pre-bundling, where it did not in 8.1.0.