diff options
author | Vitaly Takmazov | 2022-12-08 11:03:34 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2022-12-08 11:03:34 +0300 |
commit | d4beb3a3cc2928a33a89bce6be1b084a65998bbd (patch) | |
tree | ebebdad776003db865696631ff884ded34fb3b76 /webpack.config.js | |
parent | 2121aa50cc3506950eb1947d053a44a1790cf2f2 (diff) |
webpack: minify using esbuild
Diffstat (limited to 'webpack.config.js')
-rw-r--r-- | webpack.config.js | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/webpack.config.js b/webpack.config.js index a9329712..a2da5786 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -1,5 +1,6 @@ const ESLintPlugin = require('eslint-webpack-plugin'); const CopyPlugin = require('copy-webpack-plugin'); +const TerserPlugin = require('terser-webpack-plugin'); module.exports = (env, argv) => { const node_env = process.env.NODE_ENV ? process.env.NODE_ENV : 'development'; @@ -41,10 +42,32 @@ module.exports = (env, argv) => { } }; if (dev) { - config.plugins.push(new ESLintPlugin({ files: 'src/main/assets', lintDirtyModulesOnly: true, failOnWarning: false, failOnError: true, fix: false })); + config.plugins.push( + new ESLintPlugin({ + files: 'src/main/assets', + lintDirtyModulesOnly: true, + failOnWarning: false, + failOnError: true, + fix: false + })); } config.optimization = { - minimize: !dev + minimize: !dev, + minimizer: [ + new TerserPlugin({ + minify: TerserPlugin.esbuildMinify, + // `terserOptions` options will be passed to `esbuild` + // Link to options - https://esbuild.github.io/api/#minify + // Note: the `minify` options is true by default (and override other `minify*` options), so if you want to disable the `minifyIdentifiers` option (or other `minify*` options) please use: + // terserOptions: { + // minify: false, + // minifyWhitespace: true, + // minifyIdentifiers: false, + // minifySyntax: true, + // }, + terserOptions: {}, + }), + ] }; return config; }; |