File tree 3 files changed +7
-13
lines changed
3 files changed +7
-13
lines changed Original file line number Diff line number Diff line change 5
5
"type" : " module" ,
6
6
"scripts" : {
7
7
"dev" : " vite dev" ,
8
- "build" : " vite build" ,
8
+ "build" : " vite build --ssr " ,
9
9
"preview" : " vite preview" ,
10
10
"test-e2e" : " playwright test" ,
11
11
"test-e2e-preview" : " E2E_PREVIEW=1 playwright test" ,
Original file line number Diff line number Diff line change 5
5
"type" : " module" ,
6
6
"scripts" : {
7
7
"dev" : " vite dev" ,
8
- "build" : " vite build" ,
8
+ "build" : " vite build --ssr " ,
9
9
"preview" : " vite preview" ,
10
10
"cf-build" : " SSR_ENTRY=/src/adapters/cloudflare-workers.ts pnpm build && bash misc/cloudflare-workers/build.sh" ,
11
11
"cf-preview" : " cd misc/cloudflare-workers && wrangler dev" ,
Original file line number Diff line number Diff line change @@ -289,7 +289,7 @@ export function vitePluginReactServer(options?: {
289
289
} ,
290
290
} ;
291
291
292
- // orchestrate four builds from a single vite (browser ) build
292
+ // orchestrate four builds from a single vite (ssr ) build
293
293
const buildOrchestrationPlugin : Plugin = {
294
294
name : vitePluginReactServer . name + ":build" ,
295
295
apply : "build" ,
@@ -298,24 +298,18 @@ export function vitePluginReactServer(options?: {
298
298
console . log ( "▶▶▶ REACT SERVER BUILD (scan) [1/4]" ) ;
299
299
manager . buildType = "scan" ;
300
300
await build ( reactServerViteConfig ) ;
301
+
301
302
console . log ( "▶▶▶ REACT SERVER BUILD (server) [2/4]" ) ;
302
303
manager . buildType = "rsc" ;
303
304
manager . rscUseClientIds . clear ( ) ;
304
305
await build ( reactServerViteConfig ) ;
306
+
305
307
console . log ( "▶▶▶ REACT SERVER BUILD (browser) [3/4]" ) ;
306
308
manager . buildType = "client" ;
307
- }
308
- } ,
309
- async closeBundle ( ) {
310
- // TODO: build ssr only when client build succeeds
311
- if ( manager . buildType === "client" ) {
309
+ await build ( ) ;
310
+
312
311
console . log ( "▶▶▶ REACT SERVER BUILD (ssr) [4/4]" ) ;
313
312
manager . buildType = "ssr" ;
314
- await build ( {
315
- build : {
316
- ssr : true ,
317
- } ,
318
- } ) ;
319
313
}
320
314
} ,
321
315
} ;
You can’t perform that action at this time.
0 commit comments