Skip to content

Instantly share code, notes, and snippets.

@kajstrom
Created June 13, 2018 08:02
Show Gist options
  • Save kajstrom/0791c715360451c7195eee6b0464d860 to your computer and use it in GitHub Desktop.
Save kajstrom/0791c715360451c7195eee6b0464d860 to your computer and use it in GitHub Desktop.
Webpack 3 to Webpack 4
{
entry: {
pageA: "path/to/pageA_entry.js",
pageB: "path/to/pageB_entry.js",
vendor: "path/to/vendor_entry.js",
},
//.. other configuration not relevant here
plugins: [
new CommonsChunkPlugin({
name: "shared",
filename: "shared.js",
minChunks: 3
})
]
}
{
entry: {
pageA: "path/to/pageA_entry.js",
pageB: "path/to/pageB_entry.js",
vendor: "path/to/vendor_entry.js",
},
//.. other configuration not relevant here
optimization: {
splitChunks: {
cacheGroups: {
commons: {
name: "commons",
chunks: "initial",
minChunks: 3
},
vendor: {
name: "vendor",
test: "vendor",
priority: 10,
enforce: true
}
}
},
runtimeChunk: "single"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment