chore: avoid unnecessary iteration for ssr build

pull/137/head
Evan You 5 years ago
parent ce783e456e
commit 000bcaffd4

@ -85,10 +85,13 @@ export async function bundle(
}, },
generateBundle(_options, bundle) { generateBundle(_options, bundle) {
if (!isClientBuild) {
return
}
// for each .md entry chunk, adjust its name to its correct path. // for each .md entry chunk, adjust its name to its correct path.
for (const name in bundle) { for (const name in bundle) {
const chunk = bundle[name] const chunk = bundle[name]
if (isPageChunk(chunk) && isClientBuild) { if (isPageChunk(chunk)) {
// record page -> hash relations // record page -> hash relations
const hash = chunk.fileName.match(hashRE)![1] const hash = chunk.fileName.match(hashRE)![1]
const pageName = chunk.fileName.replace(hashRE, '') const pageName = chunk.fileName.replace(hashRE, '')

Loading…
Cancel
Save