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 (facebook#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 and AndyPengc12 committed Apr 15, 2024
1 parent 4edb785 commit 87783a2
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 87783a2

Please sign in to comment.