Skip to content

Commit f479562

Browse files
authored
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)
1 parent 41e9c17 commit f479562

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

packages/react-devtools-extensions/webpack.config.js

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
const {resolve} = require('path');
44
const Webpack = require('webpack');
5+
const TerserPlugin = require('terser-webpack-plugin');
56
const {
67
DARK_MODE_DIMMED_WARNING_COLOR,
78
DARK_MODE_DIMMED_ERROR_COLOR,
@@ -84,7 +85,21 @@ module.exports = {
8485
},
8586
},
8687
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+
],
88103
},
89104
plugins: [
90105
new Webpack.ProvidePlugin({

0 commit comments

Comments
 (0)