Skip to content

Commit

Permalink
Handle virtual module deps
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewp committed Jun 22, 2023
1 parent d4eb194 commit 32618c6
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion packages/astro/src/core/render/dev/vite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export async function* crawlGraph(
}
}
}
if (urlDeps.includes(importedModule.url) && !isPropagationStoppingPoint) {
if (urlDeps.includes(urlId(importedModule.url)) && !isPropagationStoppingPoint) {
importedModules.add(importedModule);
}
}
Expand All @@ -102,6 +102,14 @@ export async function* crawlGraph(
}
}

// Virtual modules URL should start with /@id/ but do not
function urlId(url: string) {
if(url[0] !== '/') {
return '/@id/' + url;
}
return url;
}

function getDepsFromEntry(entry: ModuleNode) {
let deps = entry.ssrTransformResult?.deps ?? [];
if(entry.ssrTransformResult?.dynamicDeps) {
Expand Down

0 comments on commit 32618c6

Please sign in to comment.