do not resolve renderer.serverEntrypoint url before loading it (#4143)
This commit is contained in:
parent
78eeb4075d
commit
2f0b823f28
1 changed files with 1 additions and 7 deletions
|
@ -51,13 +51,7 @@ async function loadRenderer(
|
||||||
viteServer: ViteDevServer,
|
viteServer: ViteDevServer,
|
||||||
renderer: AstroRenderer
|
renderer: AstroRenderer
|
||||||
): Promise<SSRLoadedRenderer> {
|
): Promise<SSRLoadedRenderer> {
|
||||||
// Vite modules can be out-of-date when using an un-resolved url
|
const mod = (await viteServer.ssrLoadModule(renderer.serverEntrypoint)) as { default: SSRLoadedRenderer['ssr'] };
|
||||||
// We also encountered inconsistencies when using the resolveUrl and resolveId helpers
|
|
||||||
// We've found that pulling the ID directly from the urlToModuleMap is the most stable!
|
|
||||||
const id =
|
|
||||||
viteServer.moduleGraph.urlToModuleMap.get(renderer.serverEntrypoint)?.id ??
|
|
||||||
renderer.serverEntrypoint;
|
|
||||||
const mod = (await viteServer.ssrLoadModule(id)) as { default: SSRLoadedRenderer['ssr'] };
|
|
||||||
return { ...renderer, ssr: mod.default };
|
return { ...renderer, ssr: mod.default };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue