Skip to content

Commit

Permalink
fix(streaming-ssr): Fixes running the streaming server using rw serve (
Browse files Browse the repository at this point in the history
  • Loading branch information
dac09 committed Nov 27, 2023
1 parent 1f04ce7 commit 6459562
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions packages/vite/src/streaming/createReactStreamingHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,10 @@ export const createReactStreamingHandler = async (
let fallbackDocumentImport: any

if (isProd) {
entryServerImport = await import(rwPaths.web.distEntryServer)
fallbackDocumentImport = await import(rwPaths.web.distDocumentServer)
entryServerImport = await import(makeFilePath(rwPaths.web.distEntryServer))
fallbackDocumentImport = await import(
makeFilePath(rwPaths.web.distDocumentServer)
)
}

// @NOTE: we are returning a FetchAPI handler
Expand Down Expand Up @@ -134,3 +136,8 @@ export const createReactStreamingHandler = async (
return reactResponse
}
}

function makeFilePath(path: string): string {
// Without this, absolute paths can't be imported on Windows
return 'file:///' + path
}

0 comments on commit 6459562

Please sign in to comment.