pref: JS bundling improvements (#1461)
* perf: Split only initial vendors
This commit is contained in:
@ -10,7 +10,7 @@ require('dotenv').config({ silent: true });
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
output: {
|
output: {
|
||||||
path: path.join(__dirname, 'dist'),
|
path: path.join(__dirname, 'dist'),
|
||||||
filename: 'bundle.js',
|
filename: '[name].[hash].js',
|
||||||
publicPath: '/static/',
|
publicPath: '/static/',
|
||||||
},
|
},
|
||||||
module: {
|
module: {
|
||||||
@ -64,4 +64,17 @@ module.exports = {
|
|||||||
stats: {
|
stats: {
|
||||||
assets: false,
|
assets: false,
|
||||||
},
|
},
|
||||||
|
optimization: {
|
||||||
|
runtimeChunk: 'single',
|
||||||
|
moduleIds: 'hashed',
|
||||||
|
splitChunks: {
|
||||||
|
cacheGroups: {
|
||||||
|
vendor: {
|
||||||
|
test: /[\\/]node_modules[\\/]/,
|
||||||
|
name: 'vendors',
|
||||||
|
chunks: 'initial',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
@ -7,17 +7,18 @@ const TerserPlugin = require('terser-webpack-plugin');
|
|||||||
commonWebpackConfig = require('./webpack.config');
|
commonWebpackConfig = require('./webpack.config');
|
||||||
|
|
||||||
productionWebpackConfig = Object.assign(commonWebpackConfig, {
|
productionWebpackConfig = Object.assign(commonWebpackConfig, {
|
||||||
|
output: {
|
||||||
|
path: path.join(__dirname, 'dist'),
|
||||||
|
filename: '[name].[contenthash].js',
|
||||||
|
publicPath: '/static/',
|
||||||
|
},
|
||||||
cache: true,
|
cache: true,
|
||||||
mode: "production",
|
mode: "production",
|
||||||
devtool: 'source-map',
|
devtool: 'source-map',
|
||||||
entry: ['./app/index'],
|
entry: ['./app/index'],
|
||||||
output: {
|
|
||||||
path: path.join(__dirname, 'dist'),
|
|
||||||
filename: 'bundle.[hash].js',
|
|
||||||
publicPath: '/static/',
|
|
||||||
},
|
|
||||||
stats: "normal",
|
stats: "normal",
|
||||||
optimization: {
|
optimization: {
|
||||||
|
...commonWebpackConfig.optimization,
|
||||||
minimizer: [
|
minimizer: [
|
||||||
new TerserPlugin({
|
new TerserPlugin({
|
||||||
terserOptions: {
|
terserOptions: {
|
||||||
|
Reference in New Issue
Block a user