Commit b1b0b889 authored by Arunoda Susiripala's avatar Arunoda Susiripala Committed by GitHub

Move react-dom into commons.js always. (#2572)

parent 99dd045d
import { resolve, join } from 'path' import { resolve, join, sep } from 'path'
import { createHash } from 'crypto' import { createHash } from 'crypto'
import webpack from 'webpack' import webpack from 'webpack'
import glob from 'glob-promise' import glob from 'glob-promise'
...@@ -103,6 +103,13 @@ export default async function createCompiler (dir, { dev = false, quiet = false, ...@@ -103,6 +103,13 @@ 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
} }
// 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 // 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 // used in all of the pages. Otherwise, move modules used in at-least
// 1/2 of the total pages into commons. // 1/2 of the total pages into commons.
......
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