Reputation: 21
I just replace in my webpack.dev.config.js the :
new webpack.optimize.CommonsChunkPlugin({ name: 'common', }),
by
new webpack.optimization.splitChunks({ name: 'common' }),
.
Now when I want to use yarn start
in my terminal I have the issue below:
TypeError: Cannot read property 'splitChunks' of undefined
How can I fix this please?
Thanks in advance for your help.
Upvotes: 2
Views: 2385
Reputation: 11
Fix it: plugins:
[
new HTMLWebpackPlugin({
title: 'Code splitting'enter code here
}),
],
optimization: {
splitChunks: {
chunks: 'all'
}
},
output: {
filename: '[name].bundle.js',
path: path.resolve(__dirname, 'dist')
}
Upvotes: 1