Skip to content

Instantly share code, notes, and snippets.

@jfsiii
Created January 18, 2017 03:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jfsiii/2e09e5716d0a69df730cbfe406ce366c to your computer and use it in GitHub Desktop.
Save jfsiii/2e09e5716d0a69df730cbfe406ce366c to your computer and use it in GitHub Desktop.
plugins: [
// put all npm modules in the 'vendor' chunk
// matches react modules too, but they'll be moved by the next entry
new webpack.optimize.CommonsChunkPlugin({
name: 'vendor',
minChunks: (module) => npmModuleRegex.test(module.resource)
}),
// put all key react modules in 'react' chunk
// they're ~140KB (~40KB gz) and don't change often
new webpack.optimize.CommonsChunkPlugin({
name: 'react',
minChunks: (module) => reactModuleRegex.test(module.resource)
}),
new webpack.optimize.CommonsChunkPlugin({
name: 'common',
names: [ 'manifest' ] // manifest is the code require to load other chunks
}),
...
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment