From 27d33d3e29276d0d5c61d604034d65b4c6ae5f65 Mon Sep 17 00:00:00 2001 From: Tobbe Lundberg Date: Mon, 25 Sep 2023 16:18:44 -0700 Subject: [PATCH] RSC: Handle Windows paths in clientEntries (#9233) --- packages/vite/src/buildRscFeServer.ts | 12 +++++++++++- packages/vite/src/waku-lib/rsc-handler-worker.ts | 8 ++++++-- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/packages/vite/src/buildRscFeServer.ts b/packages/vite/src/buildRscFeServer.ts index 0f36a4837e12..a4a46d08d71f 100644 --- a/packages/vite/src/buildRscFeServer.ts +++ b/packages/vite/src/buildRscFeServer.ts @@ -102,8 +102,18 @@ export const buildRscFeServer = async ({ 'moduleIds' in item && item.moduleIds.includes(clientEntryFiles[name] as string) )?.fileName + if (entryFile) { - clientEntries[entryFile] = fileName + console.log('entryFile', entryFile) + if (process.platform === 'win32') { + const entryFileSlash = entryFile.replaceAll('\\', '/') + console.log('entryFileSlash', entryFileSlash) + // Prevent errors on Windows like + // Error: No client entry found for D:/a/redwood/rsc-project/web/dist/server/assets/rsc0.js + clientEntries[entryFileSlash] = fileName + } else { + clientEntries[entryFile] = fileName + } } } diff --git a/packages/vite/src/waku-lib/rsc-handler-worker.ts b/packages/vite/src/waku-lib/rsc-handler-worker.ts index c1e1cb7d0617..e0fef6b20824 100644 --- a/packages/vite/src/waku-lib/rsc-handler-worker.ts +++ b/packages/vite/src/waku-lib/rsc-handler-worker.ts @@ -259,8 +259,9 @@ export async function setClientEntries( } const config = await configPromise const entriesFile = await getEntriesFile(config, false) - console.log('entriesFile', entriesFile) + console.log('setClientEntries :: entriesFile', entriesFile) const { clientEntries } = await loadServerFile(entriesFile) + console.log('setClientEntries :: clientEntries', clientEntries) if (!clientEntries) { throw new Error('Failed to load clientEntries') } @@ -272,7 +273,10 @@ export async function setClientEntries( ]) ) - console.log('absoluteClientEntries', absoluteClientEntries) + console.log( + 'setClientEntries :: absoluteClientEntries', + absoluteClientEntries + ) } export async function renderRSC(input: RenderInput): Promise {