Skip to content

Commit 8480c13

Browse files
committed
include ReactPerf in non-production builds
1 parent d8d82be commit 8480c13

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

make-webpack-config.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,9 @@ module.exports = function(rules, options) {
7272
new UglifyJsPlugin({
7373
uglifyOptions: {
7474
mangle: specialOptions.mangle,
75-
compress: specialOptions.mangle,
75+
compress: specialOptions.mangle ? {
76+
dead_code: true
77+
} : false,
7678
beautify: !specialOptions.mangle,
7779
},
7880

src/core/index.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ import ApisPreset from "core/presets/apis"
77
import * as AllPlugins from "core/plugins/all"
88
import { parseSearch } from "core/utils"
99

10+
if (process.env.NODE_ENV !== "production" && typeof window !== "undefined") {
11+
win.Perf = require("react-dom/lib/ReactPerf")
12+
}
13+
1014
// eslint-disable-next-line no-undef
1115
const { GIT_DIRTY, GIT_COMMIT, PACKAGE_VERSION, HOSTNAME, BUILD_TIME } = buildInfo
1216

0 commit comments

Comments
 (0)