1
0
Fork 0
mirror of https://github.com/terribleplan/next.js.git synced 2024-01-19 02:48:18 +00:00

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

This commit is contained in:
Sasha Aickin 2017-06-20 21:27:24 -07:00 committed by Arunoda Susiripala
parent 8017bd3774
commit 9c2db29166

View file

@ -102,7 +102,12 @@ export default async function createCompiler (dir, { dev = false, quiet = false,
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
}
}),