Skip to content

Commit

Permalink
refactor[devtools/extension]: minify production builds to strip comme…
Browse files Browse the repository at this point in the history
…nts (#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)
  • Loading branch information
hoxyq authored Aug 29, 2023
1 parent 41e9c17 commit f479562
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion packages/react-devtools-extensions/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

const {resolve} = require('path');
const Webpack = require('webpack');
const TerserPlugin = require('terser-webpack-plugin');
const {
DARK_MODE_DIMMED_WARNING_COLOR,
DARK_MODE_DIMMED_ERROR_COLOR,
Expand Down Expand Up @@ -84,7 +85,21 @@ module.exports = {
},
},
optimization: {
minimize: false,
minimize: !__DEV__,
minimizer: [
new TerserPlugin({
terserOptions: {
compress: false,
mangle: {
keep_fnames: true,
},
format: {
comments: false,
},
},
extractComments: false,
}),
],
},
plugins: [
new Webpack.ProvidePlugin({
Expand Down

0 comments on commit f479562

Please sign in to comment.