From 25c0437520215007f16b1f2fed8721dd01f007b9 Mon Sep 17 00:00:00 2001 From: Chunpeng Huo Date: Sun, 28 Apr 2024 11:11:56 +1000 Subject: [PATCH] fix(webpack): bypass some terser bug closes aurelia/aurelia#1953 --- webpack/webpack.config.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/webpack/webpack.config.js b/webpack/webpack.config.js index 90af7b6..7dd0f6d 100644 --- a/webpack/webpack.config.js +++ b/webpack/webpack.config.js @@ -5,6 +5,7 @@ const path = require('path'); const HtmlWebpackPlugin = require('html-webpack-plugin'); const {BundleAnalyzerPlugin} = require('webpack-bundle-analyzer'); const Dotenv = require('dotenv-webpack'); +const TerserPlugin = require('terser-webpack-plugin'); // @if jasmine || mocha const WebpackShellPluginNext = require('webpack-shell-plugin-next') // @endif @@ -60,6 +61,19 @@ module.exports = function(env, { /* @if jasmine || mocha*/runTest, /* @endif */a // @endif mode: production ? 'production' : 'development', devtool: production ? undefined : 'eval-cheap-source-map', + optimization: { + minimizer: [ + new TerserPlugin({ + terserOptions: { + // Terser fast minify mode + // https://github.com/terser-js/terser#terser-fast-minify-mode + // It's a good balance on size and speed to turn off compress. + // Also bypass some terser bug. + compress: false + }, + }), + ], + }, // @if jasmine || mocha entry: { entry: test ?