const os = require('os')
const CssMinimizerPlugin = require('css-minimizer-webpack-plugin')
// ...
module.exports = (_env, argv) => {
// ...
return {
optimization: {
minimize: true,
minimizer: [
new CssMinimizerPlugin({
parallel: os.cpus().length - 1
}),
],
},
splitChunks: {
chunks: 'all',
minSize: 0,
minRemainingSize: 0,
maxSize: 0,
minChunks: 1,
maxAsyncRequests: 30,
maxInitialRequests: 20,
enforceSizeThreshold: 50000,
cacheGroups: {
defaultVendors: {
test: /[\\/]node_modules[\\/]/,
priority: -10,
reuseExistingChunk: true,
},
default: {
minChunks: 2,
priority: -10,
reuseExistingChunk: true,
},
},
},
}
}