Skip to content

Commit

Permalink
adds comments
Browse files Browse the repository at this point in the history
  • Loading branch information
alexanderniebuhr committed Apr 22, 2024
1 parent ab4cdf1 commit 22df2c4
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/cloudflare/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,15 +125,18 @@ export default function createIntegration(args?: Options): AstroIntegration {

const constsToRemove: string[] = [];
walk(astrojsSSRVirtualEntryAST, {
leave(node, parent, prop, index) {
leave(node) {
// We are only looking for VariableDeclarations, since both (dynamic imports and pageMap) are declared as constants in the code
if (node.type !== 'VariableDeclaration') return;
if (
!node.declarations[0] ||
node.declarations[0].type !== 'VariableDeclarator'
)
return;

// This function will remove the dynamic imports from the entrypoint
mutateDynamicPageImportsInPlace(node, prerenderImports, constsToRemove, s);
// This function will remove the pageMap entries which are invalid now
mutatePageMapInPlace(node, constsToRemove, s);
},
});
Expand Down

0 comments on commit 22df2c4

Please sign in to comment.