Skip to content

Commit

Permalink
do not resolve renderer.serverEntrypoint url before loading it
Browse files Browse the repository at this point in the history
  • Loading branch information
FredKSchott committed Aug 4, 2022
1 parent 66319cb commit 7c615ea
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions packages/astro/src/core/render/dev/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,7 @@ async function loadRenderer(
viteServer: ViteDevServer,
renderer: AstroRenderer
): Promise<SSRLoadedRenderer> {
// Vite modules can be out-of-date when using an un-resolved url
// 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'] };
const mod = (await viteServer.ssrLoadModule(renderer.serverEntrypoint)) as { default: SSRLoadedRenderer['ssr'] };
return { ...renderer, ssr: mod.default };
}

Expand Down

0 comments on commit 7c615ea

Please sign in to comment.