chore: add perf improvements

This commit is contained in:
Even Stensberg 2020-11-20 22:54:41 +01:00
parent c9d9730726
commit 8d39d91b44
No known key found for this signature in database
GPG key ID: 889FAA91782F6DC7
3 changed files with 1446 additions and 22 deletions

View file

@ -1,7 +1,9 @@
const path = require("path");
const webpack = require("webpack");
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const CopyWebpackPlugin = require("copy-webpack-plugin");
const path = require("path");
const TerserPlugin = require("terser-webpack-plugin");
const OptimizeCssAssetsPlugin = require("optimize-css-assets-webpack-plugin");
/**
* Webpack configuration details for use with Grunt.
@ -189,5 +191,45 @@ module.exports = {
},
performance: {
hints: false
}
},
optimization: {
runtimeChunk: false,
splitChunks: {
cacheGroups: {
default: false,
commons: {
test: /[\\/]node_modules[\\/]/,
name: "vendor_app",
chunks: "all",
minChunks: 2
}
}
},
minimizer: [
new TerserPlugin({
terserOptions: {
output: {
comments: false
},
ecma: undefined,
warnings: false,
mangle: true,
module: false,
toplevel: false,
nameCache: null,
ie8: false,
}
}),
new OptimizeCssAssetsPlugin({
assetNameRegExp: /\.optimize\.css$/g,
cssProcessor: require("cssnano"),
cssProcessorPluginOptions: {
preset: ["default", { discardComments: { removeAll: true } }]
},
canPrint: true
})
]
},
};