Commit 9c2db291 authored by Sasha Aickin's avatar Sasha Aickin Committed by Arunoda Susiripala

Fixed an issue where two-page sites didn't split code. (#2329)

parent 8017bd37
...@@ -102,7 +102,12 @@ export default async function createCompiler (dir, { dev = false, quiet = false, ...@@ -102,7 +102,12 @@ export default async function createCompiler (dir, { dev = false, quiet = false,
return module.context && module.context.indexOf('node_modules') >= 0 return module.context && module.context.indexOf('node_modules') >= 0
} }
// Move modules used in at-least 1/2 of the total pages into commons. // If there are one or two pages, only move modules to common if they are
// used in all of the pages. Otherwise, move modules used in at-least
// 1/2 of the total pages into commons.
if (totalPages <= 2) {
return count === totalPages
}
return count >= totalPages * 0.5 return count >= totalPages * 0.5
} }
}), }),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment