Skip to content

Commit 16df13b

Browse files
authored
[DevTools] Minify backend (#34507)
1 parent 7899729 commit 16df13b

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

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

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
const {resolve, isAbsolute, relative} = require('path');
44
const Webpack = require('webpack');
5+
const TerserPlugin = require('terser-webpack-plugin');
56

67
const {resolveFeatureFlags} = require('react-devtools-shared/buildUtils');
78
const SourceMapIgnoreListPlugin = require('react-devtools-shared/SourceMapIgnoreListPlugin');
@@ -56,16 +57,32 @@ module.exports = {
5657
},
5758
},
5859
optimization: {
59-
minimize: false,
60+
minimize: !__DEV__,
61+
minimizer: [
62+
new TerserPlugin({
63+
terserOptions: {
64+
compress: {
65+
unused: true,
66+
dead_code: true,
67+
},
68+
mangle: {
69+
keep_fnames: true,
70+
},
71+
format: {
72+
comments: false,
73+
},
74+
},
75+
extractComments: false,
76+
}),
77+
],
6078
},
6179
plugins: [
6280
new Webpack.ProvidePlugin({
6381
process: 'process/browser',
6482
}),
6583
new Webpack.DefinePlugin({
66-
__DEV__: true,
84+
__DEV__,
6785
__PROFILE__: false,
68-
__DEV____DEV__: true,
6986
// By importing `shared/` we may import ReactFeatureFlags
7087
__EXPERIMENTAL__: true,
7188
'process.env.DEVTOOLS_PACKAGE': `"react-devtools-extensions"`,

0 commit comments

Comments
 (0)