@@ -92,28 +92,28 @@ test.describe(() => {
9292 src : 'examples/starter' ,
9393 dest : root ,
9494 files : {
95+ 'vite.config.base.ts' : { cp : 'vite.config.ts' } ,
9596 'vite.config.ts' : /* js */ `
9697 import rsc from '@vitejs/plugin-rsc'
9798 import react from '@vitejs/plugin-react'
98- import { defineConfig } from 'vite'
99+ import { defineConfig, mergeConfig } from 'vite'
100+ import baseConfig from './vite.config.base.ts'
101+
102+ delete baseConfig.plugins
99103
100- export default defineConfig({
104+ const overrideConfig = defineConfig({
101105 plugins: [
102106 react({
103107 babel: { plugins: ['babel-plugin-react-compiler'] },
104108 }).map((p) => ({
105109 ...p,
106110 applyToEnvironment: (e) => e.name === 'client',
107111 })),
108- rsc({
109- entries: {
110- client: './src/framework/entry.browser.tsx',
111- ssr: './src/framework/entry.ssr.tsx',
112- rsc: './src/framework/entry.rsc.tsx',
113- }
114- }),
112+ rsc(),
115113 ],
116114 })
115+
116+ export default mergeConfig(baseConfig, overrideConfig)
117117 ` ,
118118 } ,
119119 } )
@@ -145,24 +145,16 @@ test.describe(() => {
145145 src : 'examples/starter' ,
146146 dest : root ,
147147 files : {
148+ 'vite.config.base.ts' : { cp : 'vite.config.ts' } ,
148149 'vite.config.ts' : /* js */ `
149- import rsc from '@vitejs/plugin-rsc'
150- import react from '@vitejs/plugin-react'
151- import { defineConfig } from 'vite'
150+ import { defineConfig, mergeConfig } from 'vite'
151+ import baseConfig from './vite.config.base.ts'
152152
153- export default defineConfig({
153+ const overrideConfig = defineConfig({
154154 base: '/custom-base/',
155- plugins: [
156- react(),
157- rsc({
158- entries: {
159- client: './src/framework/entry.browser.tsx',
160- ssr: './src/framework/entry.ssr.tsx',
161- rsc: './src/framework/entry.rsc.tsx',
162- }
163- }),
164- ],
165155 })
156+
157+ export default mergeConfig(baseConfig, overrideConfig)
166158 ` ,
167159 } ,
168160 } )
@@ -193,22 +185,12 @@ test.describe(() => {
193185 src : 'examples/starter' ,
194186 dest : root ,
195187 files : {
188+ 'vite.config.base.ts' : { cp : 'vite.config.ts' } ,
196189 'vite.config.ts' : /* js */ `
197- import rsc from '@vitejs/plugin-rsc'
198- import react from '@vitejs/plugin-react'
199- import { defineConfig, createRunnableDevEnvironment } from 'vite'
190+ import { defineConfig, mergeConfig, createRunnableDevEnvironment } from 'vite'
191+ import baseConfig from './vite.config.base.ts'
200192
201- export default defineConfig({
202- plugins: [
203- react(),
204- rsc({
205- entries: {
206- client: './src/framework/entry.browser.tsx',
207- ssr: './src/framework/entry.ssr.tsx',
208- rsc: './src/framework/entry.rsc.tsx',
209- }
210- }),
211- ],
193+ const overrideConfig = defineConfig({
212194 environments: {
213195 ssr: {
214196 dev: {
@@ -234,6 +216,8 @@ test.describe(() => {
234216 },
235217 },
236218 })
219+
220+ export default mergeConfig(baseConfig, overrideConfig)
237221 ` ,
238222 } ,
239223 } )
0 commit comments