فهرست منبع

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 سال پیش
والد
کامیت
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: {
     optimization: {
       // Minify JS (with Terser) and CSS (with cssnano)
       // 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: [
     plugins: [