Answer the question
In order to leave comments, you need to log in
How to split a chunk with vendors using SplitChunksPlugin?
webpack4. There is a setting:
optimization: {
splitChunks: {
chunks: 'all',
minSize: 30000,
minChunks: 1,
maxAsyncRequests: 5,
maxInitialRequests: 3,
automaticNameDelimiter: '~',
name: false,
cacheGroups: {
vendors: {
test: /[\\/]node_modules[\\/]/,
priority: -10,
name: 'vendors',
maxSize: 240000,
},
default: {
minChunks: 2,
priority: -20,
reuseExistingChunk: true,
},
},
},
},
new HtmlWebpackPlugin({
chunks: ['app', 'vendors'],
hash: true,
template: path.join(paths.PUBLIC, 'index.html'),
filename: 'index.html',
}),
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question