diff --git a/src/node/build/render.ts b/src/node/build/render.ts index 89689166..9102fd09 100644 --- a/src/node/build/render.ts +++ b/src/node/build/render.ts @@ -88,12 +88,18 @@ function resolvePageImports( ) { // find the page's js chunk and inject script tags for its imports so that // they are start fetching as early as possible - const srcPath = normalizePath(path.resolve(config.root, page)) const pageChunk = result.output.find( (chunk) => chunk.type === 'chunk' && chunk.facadeModuleId === srcPath ) as OutputChunk - return Array.from(new Set([...indexChunk.imports, ...pageChunk.imports])) + return Array.from( + new Set([ + ...indexChunk.imports, + ...indexChunk.dynamicImports, + ...pageChunk.imports, + ...pageChunk.dynamicImports + ]) + ) } function renderHead(head: HeadConfig[]) {