Skip to content

Commit

Permalink
RSC: Handle Windows paths in clientEntries (#9233)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tobbe committed Sep 25, 2023
1 parent 61f0f51 commit 27d33d3
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
12 changes: 11 additions & 1 deletion packages/vite/src/buildRscFeServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
}

Expand Down
8 changes: 6 additions & 2 deletions packages/vite/src/waku-lib/rsc-handler-worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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')
}
Expand All @@ -272,7 +273,10 @@ export async function setClientEntries(
])
)

console.log('absoluteClientEntries', absoluteClientEntries)
console.log(
'setClientEntries :: absoluteClientEntries',
absoluteClientEntries
)
}

export async function renderRSC(input: RenderInput): Promise<PipeableStream> {
Expand Down

0 comments on commit 27d33d3

Please sign in to comment.