File tree Expand file tree Collapse file tree 2 files changed +9
-6
lines changed Expand file tree Collapse file tree 2 files changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -245,6 +245,14 @@ export default function viteReact(opts: Options = {}): Plugin[] {
245245 } ) ( )
246246 const plugins = [ ...babelOptions . plugins ]
247247
248+ // remove react-compiler plugin on non client environment
249+ if ( ssr ) {
250+ const reactCompilerPlugin = getReactCompilerPlugin ( plugins )
251+ if ( reactCompilerPlugin ) {
252+ plugins . splice ( plugins . indexOf ( reactCompilerPlugin ) , 1 )
253+ }
254+ }
255+
248256 const isJSX = filepath . endsWith ( 'x' )
249257 const useFastRefresh =
250258 ! skipFastRefresh &&
Original file line number Diff line number Diff line change @@ -22,12 +22,7 @@ test.describe(() => {
2222
2323 const overrideConfig = defineConfig({
2424 plugins: [
25- react({
26- babel: { plugins: ['babel-plugin-react-compiler'] },
27- }).map((p) => ({
28- ...p,
29- applyToEnvironment: (e) => e.name === 'client',
30- })),
25+ react({ babel: { plugins: ['babel-plugin-react-compiler'] } }),
3126 rsc(),
3227 ],
3328 })
You can’t perform that action at this time.
0 commit comments