perf: generate preload directives for dynamicImport chunks too

pull/207/head
Evan You 4 years ago
parent 12b16259ce
commit b9fc0cb78d

@ -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[]) {

Loading…
Cancel
Save