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
This commit is contained in:
Alf Eaton
2021-02-10 03:04:43 +00:00
committed by Copybot
parent 260b878b7d
commit b611c307d7
+9 -1
View File
@@ -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: [