refactor[devtools/extension]: minify production builds to strip comments (#27304)
Currently, we are unable to publish a release to Firefox extensions store, due to `parseHookNames` chunk size, which is ~5mb. We were not minifying production builds on purpose, to have more descriptive error messages. Now, Terser plugin will only: - remove comments - mangle, but keeping function names (for understandable bug reports)
Ruslan Lesiutin committed
Aug 29, 2023 at 12:09 UTC
f47956239f6892a1e805af1fc3f1b2fb0f66beca
1 file changed
+16
-1
packages/react-devtools-extensions/webpack.config.js
+16
-1
@@ -2,6 +2,7 @@
2
3
const {resolve} = require('path');
4
const Webpack = require('webpack');
5
+const TerserPlugin = require('terser-webpack-plugin');
6
const {
7
DARK_MODE_DIMMED_WARNING_COLOR,
8
DARK_MODE_DIMMED_ERROR_COLOR,
@@ -84,7 +85,21 @@ module.exports = {
85
},
86
},
87
optimization: {
87
- minimize: false,
88
+ minimize: !__DEV__,
89
+ minimizer: [
90
+ new TerserPlugin({
91
+ terserOptions: {
92
+ compress: false,
93
+ mangle: {
94
+ keep_fnames: true,
95
+ },
96
+ format: {
97
+ comments: false,
98
+ },
99
+ },
100
+ extractComments: false,
101
+ }),
102
+ ],
103
},
104
plugins: [
105
new Webpack.ProvidePlugin({