mirror of
https://github.com/terribleplan/next.js.git
synced 2024-01-19 02:48:18 +00:00
Move react-dom into commons.js always. (#2572)
This commit is contained in:
parent
99dd045d1c
commit
b1b0b88945
|
@ -1,4 +1,4 @@
|
|||
import { resolve, join } from 'path'
|
||||
import { resolve, join, sep } from 'path'
|
||||
import { createHash } from 'crypto'
|
||||
import webpack from 'webpack'
|
||||
import glob from 'glob-promise'
|
||||
|
@ -103,6 +103,13 @@ export default async function createCompiler (dir, { dev = false, quiet = false,
|
|||
return module.context && module.context.indexOf('node_modules') >= 0
|
||||
}
|
||||
|
||||
// We need to move react-dom explicitly into common chunks.
|
||||
// Otherwise, if some other page or module uses it, it might
|
||||
// included in that bundle too.
|
||||
if (module.context.indexOf(`${sep}react-dom${sep}`) >= 0) {
|
||||
return true
|
||||
}
|
||||
|
||||
// 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.
|
||||
|
|
Loading…
Reference in a new issue