Просмотр исходного кода

Set TerserPlugin to not minify *Error classes/functions (#3615)

Set the `keep_classnames` and `keep_fnames` options for TerserPlugin, to keep OError and subclass names intact so they can be accessed by this.constructor.name

GitOrigin-RevId: 109fb81558b977ccc4acdb69f8544f7693940919
Alf Eaton 5 лет назад
Родитель
Сommit
b611c307d7
1 измененных файлов с 9 добавлено и 1 удалено
  1. 9 1
      services/web/webpack.config.prod.js

+ 9 - 1
services/web/webpack.config.prod.js

@@ -42,7 +42,15 @@ module.exports = merge.smart(
 
     optimization: {
       // Minify JS (with Terser) and CSS (with cssnano)
-      minimizer: [new TerserPlugin(), new OptimizeCssAssetsPlugin()]
+      minimizer: [
+        new TerserPlugin({
+          terserOptions: {
+            keep_classnames: /Error$/,
+            keep_fnames: /Error$/
+          }
+        }),
+        new OptimizeCssAssetsPlugin()
+      ]
     },
 
     plugins: [