@@ -11,6 +11,7 @@ import { buildApi } from '@redwoodjs/internal/dist/build/api'
1111import { loadAndValidateSdls } from '@redwoodjs/internal/dist/validateSchema'
1212import { detectPrerenderRoutes } from '@redwoodjs/prerender/detection'
1313import { timedTelemetry } from '@redwoodjs/telemetry'
14+ import { buildFeServer } from '@redwoodjs/vite'
1415
1516import { getPaths , getConfig } from '../lib'
1617import { generatePrismaCommand } from '../lib/generatePrismaClient'
@@ -105,19 +106,28 @@ export const handler = async ({
105106 title : 'Building Web...' ,
106107 task : async ( ) => {
107108 if ( getConfig ( ) . web . bundler !== 'webpack' ) {
108- // @NOTE : we're using the vite build command here, instead of the
109- // buildWeb function directly because we want the process.cwd to be
110- // the web directory, not the root of the project.
111- // This is important for postcss/tailwind to work correctly
112- // Having a separate binary lets us contain the change of cwd to that
113- // process only. If we changed cwd here, or in the buildWeb function,
114- // it could affect other things that run in parallel while building.
115- // We don't have any parallel tasks right now, but someone might add
116- // one in the future as a performance optimization.
117- await execa ( `yarn rw-vite-build --webDir="${ rwjsPaths . web . base } "` , {
118- stdio : verbose ? 'inherit' : 'pipe' ,
119- shell : true ,
120- } )
109+ if ( ! getConfig ( ) . experimental ?. streamingSsr ?. enabled ) {
110+ // @NOTE : we're using the vite build command here, instead of the
111+ // buildWeb function directly because we want the process.cwd to be
112+ // the web directory, not the root of the project.
113+ // This is important for postcss/tailwind to work correctly
114+ // Having a separate binary lets us contain the change of cwd to that
115+ // process only. If we changed cwd here, or in the buildWeb function,
116+ // it could affect other things that run in parallel while building.
117+ // We don't have any parallel tasks right now, but someone might add
118+ // one in the future as a performance optimization.
119+ await execa ( `yarn rw-vite-build --webDir="${ rwjsPaths . web . base } "` , {
120+ stdio : verbose ? 'inherit' : 'pipe' ,
121+ shell : true ,
122+ } )
123+ } else {
124+ // TODO (STREAMING) we need to contain this in a separate binary
125+ process . chdir ( rwjsPaths . web . base )
126+
127+ // TODO (STREAMING) we need to use a binary here, so the the cwd is correct
128+ // Should merge this with the existing rw-vite-build binary
129+ await buildFeServer ( { verbose } )
130+ }
121131 } else {
122132 await execa (
123133 `yarn cross-env NODE_ENV=production webpack --config ${ require . resolve (
0 commit comments