From 68adde98c83a1f00b4fdd829623ba6e2f67a4ad4 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 19 Jul 2026 10:01:00 +0000 Subject: [PATCH] fix: resolve outDir against Vite root in buildApp buildApp used the configured outDir values of the rsc and client environments directly, which resolve against process.cwd() when relative. If vite build is run from a directory other than the Vite root (e.g. monorepo root with --config), the RSC entry import and output writes could target the wrong location. Resolve both against config.root, matching what serverPlugin already does. This also guarantees BuildEntryContext.outDir is absolute, as documented. Closes #141 Co-Authored-By: Claude Fable 5 Claude-Session: https://claude.ai/code/session_01DEURCLVLKQvqYUrAkqcHpE --- packages/static/src/build/buildApp.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/packages/static/src/build/buildApp.ts b/packages/static/src/build/buildApp.ts index aadee83..03d2efe 100644 --- a/packages/static/src/build/buildApp.ts +++ b/packages/static/src/build/buildApp.ts @@ -17,12 +17,20 @@ export async function buildApp( ) { const { config } = builder; // import server entry - const entryPath = path.join(config.environments.rsc.build.outDir, "index.js"); + // outDir may be relative, in which case it is relative to the Vite root + // (not process.cwd()) + const entryPath = path.join( + path.resolve(config.root, config.environments.rsc.build.outDir), + "index.js", + ); const entry: typeof import("../rsc/entry") = await import( pathToFileURL(entryPath).href ); - const baseDir = config.environments.client.build.outDir; + const baseDir = path.resolve( + config.root, + config.environments.client.build.outDir, + ); const base = normalizeBase(config.base); async function doBuild() {