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

1419
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -48,6 +48,7 @@
"colors": "^1.4.0", "colors": "^1.4.0",
"copy-webpack-plugin": "^5.1.1", "copy-webpack-plugin": "^5.1.1",
"css-loader": "^3.4.2", "css-loader": "^3.4.2",
"cssnano": "^4.1.10",
"eslint": "^6.8.0", "eslint": "^6.8.0",
"exports-loader": "^0.7.0", "exports-loader": "^0.7.0",
"file-loader": "^6.0.0", "file-loader": "^6.0.0",
@ -68,6 +69,7 @@
"mini-css-extract-plugin": "^0.9.0", "mini-css-extract-plugin": "^0.9.0",
"nightwatch": "^1.3.5", "nightwatch": "^1.3.5",
"node-sass": "^4.13.1", "node-sass": "^4.13.1",
"optimize-css-assets-webpack-plugin": "^5.0.4",
"postcss-css-variables": "^0.14.0", "postcss-css-variables": "^0.14.0",
"postcss-import": "^12.0.1", "postcss-import": "^12.0.1",
"postcss-loader": "^3.0.0", "postcss-loader": "^3.0.0",
@ -76,6 +78,7 @@
"sitemap": "^6.1.0", "sitemap": "^6.1.0",
"style-loader": "^1.1.3", "style-loader": "^1.1.3",
"svg-url-loader": "^5.0.0", "svg-url-loader": "^5.0.0",
"terser-webpack-plugin": "^4.2.3",
"url-loader": "^4.0.0", "url-loader": "^4.0.0",
"webpack": "^4.42.0", "webpack": "^4.42.0",
"webpack-bundle-analyzer": "^3.6.1", "webpack-bundle-analyzer": "^3.6.1",

View file

@ -1,7 +1,9 @@
const path = require("path");
const webpack = require("webpack"); const webpack = require("webpack");
const MiniCssExtractPlugin = require("mini-css-extract-plugin"); const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const CopyWebpackPlugin = require("copy-webpack-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. * Webpack configuration details for use with Grunt.
@ -189,5 +191,45 @@ module.exports = {
}, },
performance: { performance: {
hints: false 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
})
]
},
}; };