@samitouri / QOS-React / commits / 16df13b84c

[DevTools] Minify backend (#34507)

Sebastian "Sebbie" Silbermann committed Sep 17, 2025 at 14:52 UTC 16df13b84c40d92ca1bb2dee552f5a780e292d41
1 file changed +20 -3
packages/react-devtools-extensions/webpack.backend.js
+20 -3
@@ -2,6 +2,7 @@
2
3 const {resolve, isAbsolute, relative} = require('path');
4 const Webpack = require('webpack');
5 +const TerserPlugin = require('terser-webpack-plugin');
6
7 const {resolveFeatureFlags} = require('react-devtools-shared/buildUtils');
8 const SourceMapIgnoreListPlugin = require('react-devtools-shared/SourceMapIgnoreListPlugin');
@@ -56,16 +57,32 @@ module.exports = {
57 },
58 },
59 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 + ],
78 },
79 plugins: [
80 new Webpack.ProvidePlugin({
81 process: 'process/browser',
82 }),
83 new Webpack.DefinePlugin({
66 - __DEV__: true,
84 + __DEV__,
85 __PROFILE__: false,
68 - __DEV____DEV__: true,
86 // By importing `shared/` we may import ReactFeatureFlags
87 __EXPERIMENTAL__: true,
88 'process.env.DEVTOOLS_PACKAGE': `"react-devtools-extensions"`,