Browse Source

fix: add js minimizer terser

main
Inhji Y. 7 months ago
parent
commit
3e8732bf99
  1. 1
      assets/package-lock.json
  2. 1
      assets/package.json
  3. 6
      assets/webpack.config.js

1
assets/package-lock.json

@ -31,6 +31,7 @@
"sass": "^1.32.7",
"sass-loader": "^11.0.1",
"sass-material-colors": "^0.0.5",
"terser-webpack-plugin": "^5.1.1",
"webpack": "^5.21.2",
"webpack-bundle-analyzer": "^4.4.0",
"webpack-cli": "^4.x"

1
assets/package.json

@ -31,6 +31,7 @@
"sass": "^1.32.7",
"sass-loader": "^11.0.1",
"sass-material-colors": "^0.0.5",
"terser-webpack-plugin": "^5.1.1",
"webpack": "^5.21.2",
"webpack-bundle-analyzer": "^4.4.0",
"webpack-cli": "^4.x"

6
assets/webpack.config.js

@ -4,6 +4,7 @@ const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const CssMinimizerPlugin = require('css-minimizer-webpack-plugin');
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
const TerserPlugin = require('terser-webpack-plugin');
module.exports = (env, options) => {
const devMode = options.mode !== 'production';
@ -49,7 +50,7 @@ module.exports = (env, options) => {
]
},
plugins: [
new BundleAnalyzerPlugin({analyzerMode: 'disabled'}),
new BundleAnalyzerPlugin({ analyzerMode: 'disabled' }),
new MiniCssExtractPlugin({ filename: '../css/app.css' }),
new CopyWebpackPlugin({
patterns: [
@ -59,7 +60,8 @@ module.exports = (env, options) => {
],
optimization: {
minimizer: [
new CssMinimizerPlugin()
new CssMinimizerPlugin(),
new TerserPlugin()
]
},
devtool: devMode ? 'source-map' : undefined

Loading…
Cancel
Save