Webpack splitting chunks examples
const webpack = require('webpack')
import baseConfig from './webpack.config.babel.js'
module.exports = { // eslint-disable-line
...baseConfig,
mode: 'production',
devtool: 'source-map',
plugins: [
new webpack.HashedModuleIdsPlugin()
],
optimization: {
runtimeChunk: 'single',
splitChunks: {
chunks: 'all'
}
}
}
const webpack = require('webpack')
import baseConfig from './webpack.config.babel.js'
module.exports = { // eslint-disable-line
...baseConfig,
mode: 'production',
devtool: 'source-map',
plugins: [
new webpack.HashedModuleIdsPlugin()
],
optimization: {
runtimeChunk: 'single',
splitChunks: {
chunks: 'all'
}
}
}
const webpack = require('webpack')
import baseConfig from './webpack.config.babel.js'
module.exports = { // eslint-disable-line
...baseConfig,
mode: 'production',
devtool: 'source-map',
plugins: [
new webpack.HashedModuleIdsPlugin()
],
optimization: {
runtimeChunk: 'single',
splitChunks: {
chunks: 'all',
maxInitialRequests: Infinity,
minSize: 12000,
cacheGroups: {
vendor: {
test: /[\\/]node_modules[\\/]/,
name (module) {
const packageName = module.context.match(/[\\/]node_modules[\\/](.*?)([\\/]|$)/)[1]
return `npm.${packageName.replace('@', '')}`
}
}
}
}
}
}