Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9c2db29

Browse files
aickinarunoda
authored andcommitted
Fixed an issue where two-page sites didn't split code. (vercel#2329)
1 parent 8017bd3 commit 9c2db29

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

server/build/webpack.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,12 @@ export default async function createCompiler (dir, { dev = false, quiet = false,
102102
return module.context && module.context.indexOf('node_modules') >= 0
103103
}
104104

105-
// Move modules used in at-least 1/2 of the total pages into commons.
105+
// If there are one or two pages, only move modules to common if they are
106+
// used in all of the pages. Otherwise, move modules used in at-least
107+
// 1/2 of the total pages into commons.
108+
if (totalPages <= 2) {
109+
return count === totalPages
110+
}
106111
return count >= totalPages * 0.5
107112
}
108113
}),

0 commit comments

Comments
 (0)