I'm using Webpack 4 and wanted to split two entry points and avoid duplication. So, I have react and react-dom in both chunks.
entry: {
index: ['babel-polyfill', './app/app.jsx'],
vendor: [
'react',
'react-dom'
]
}
splitChunks: {
cacheGroups: {
index: {
minChunks: 2,
priority: -20,
reuseExistingChunk: true
},
vendor: {
test: /[\\/]node_modules[\\/]/,
priority: -10
}
}
}