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[] {
245
245
} ) ( )
246
246
const plugins = [ ...babelOptions . plugins ]
247
247
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
+
248
256
const isJSX = filepath . endsWith ( 'x' )
249
257
const useFastRefresh =
250
258
! skipFastRefresh &&
Original file line number Diff line number Diff line change @@ -22,12 +22,7 @@ test.describe(() => {
22
22
23
23
const overrideConfig = defineConfig({
24
24
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'] } }),
31
26
rsc(),
32
27
],
33
28
})
You can’t perform that action at this time.
0 commit comments