pref: JS bundling improvements (#1461)

* perf: Split only initial vendors
This commit is contained in:
Tom Moor
2020-08-17 22:09:12 -07:00
committed by GitHub
parent d885252fb0
commit 0555fd2caa
2 changed files with 34 additions and 20 deletions

View File

@ -10,7 +10,7 @@ require('dotenv').config({ silent: true });
module.exports = {
output: {
path: path.join(__dirname, 'dist'),
filename: 'bundle.js',
filename: '[name].[hash].js',
publicPath: '/static/',
},
module: {
@ -64,4 +64,17 @@ module.exports = {
stats: {
assets: false,
},
optimization: {
runtimeChunk: 'single',
moduleIds: 'hashed',
splitChunks: {
cacheGroups: {
vendor: {
test: /[\\/]node_modules[\\/]/,
name: 'vendors',
chunks: 'initial',
},
},
},
}
};

View File

@ -7,17 +7,18 @@ const TerserPlugin = require('terser-webpack-plugin');
commonWebpackConfig = require('./webpack.config');
productionWebpackConfig = Object.assign(commonWebpackConfig, {
output: {
path: path.join(__dirname, 'dist'),
filename: '[name].[contenthash].js',
publicPath: '/static/',
},
cache: true,
mode: "production",
devtool: 'source-map',
entry: ['./app/index'],
output: {
path: path.join(__dirname, 'dist'),
filename: 'bundle.[hash].js',
publicPath: '/static/',
},
stats: "normal",
optimization: {
...commonWebpackConfig.optimization,
minimizer: [
new TerserPlugin({
terserOptions: {