From c1e62c29d1f706edbabee2abbcf96f8dad744373 Mon Sep 17 00:00:00 2001 From: Tobbe Lundberg Date: Tue, 11 Jul 2023 09:38:40 +0200 Subject: [PATCH] Include standard vite config in RSC build (#8882) --- packages/vite/src/buildRscFeServer.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/vite/src/buildRscFeServer.ts b/packages/vite/src/buildRscFeServer.ts index 4a42d3ef78..5da1580075 100644 --- a/packages/vite/src/buildRscFeServer.ts +++ b/packages/vite/src/buildRscFeServer.ts @@ -18,6 +18,11 @@ interface BuildOptions { export const buildFeServer = async ({ verbose: _verbose }: BuildOptions) => { const rwPaths = getPaths() + const viteConfig = rwPaths.web.viteConfig + + if (!viteConfig) { + throw new Error('Vite config not found') + } const clientEntryFileSet = new Set() const serverEntryFileSet = new Set() @@ -29,7 +34,7 @@ export const buildFeServer = async ({ verbose: _verbose }: BuildOptions) => { * Doesn't output any files, only collects a list of RSCs and RSFs */ await viteBuild({ - // ...configFileConfig, + configFile: viteConfig, root: rwPaths.base, plugins: [ react(), @@ -85,7 +90,7 @@ export const buildFeServer = async ({ verbose: _verbose }: BuildOptions) => { } const clientBuildOutput = await viteBuild({ - // ...configFileConfig, + configFile: viteConfig, root: rwPaths.web.src, plugins: [ // TODO (RSC) Update index.html to include the entry.client.js script