File tree Expand file tree Collapse file tree 1 file changed +15
-7
lines changed
packages/plugin-rsc/examples/basic Expand file tree Collapse file tree 1 file changed +15
-7
lines changed Original file line number Diff line number Diff line change 11import assert from 'node:assert'
22import rsc , { transformHoistInlineDirective } from '@vitejs/plugin-rsc'
33import tailwindcss from '@tailwindcss/vite'
4- import react from '@vitejs/plugin-react'
4+ import react , { type ViteReactPluginApi } from '@vitejs/plugin-react'
55import { type Plugin , defineConfig , normalizePath , parseAstAsync } from 'vite'
66import inspect from 'vite-plugin-inspect'
77import path from 'node:path'
@@ -23,12 +23,20 @@ export default defineConfig({
2323 plugins : [
2424 tailwindcss ( ) ,
2525 process . env . TEST_REACT_COMPILER
26- ? react ( { babel : { plugins : [ 'babel-plugin-react-compiler' ] } } ) . map (
27- ( p : any ) => ( {
28- ...p ,
29- applyToEnvironment : ( e : any ) => e . name === 'client' ,
30- } ) ,
31- )
26+ ? [
27+ react ( { babel : { plugins : [ 'babel-plugin-react-compiler' ] } } ) ,
28+ // skip react compiler in non CSR environments
29+ {
30+ name : 'react-babel-override' ,
31+ api : {
32+ reactBabel : ( babelConfig , context ) => {
33+ if ( context . ssr ) {
34+ babelConfig . plugins = [ ]
35+ }
36+ } ,
37+ } satisfies ViteReactPluginApi ,
38+ } ,
39+ ]
3240 : react ( ) ,
3341 vitePluginUseCache ( ) ,
3442 rsc ( {
You can’t perform that action at this time.
0 commit comments