Move performance debugging tools to app.jsx

This commit is contained in:
Owen Conti
2017-08-19 08:33:03 -06:00
parent c0cfaabd7e
commit e61c12fe18
2 changed files with 14 additions and 6 deletions

View File

@@ -1,6 +1,16 @@
import React from "react"
import PropTypes from "prop-types"
let Perf = null
let ReactPerfTool = null
if (process.env.NODE_ENV !== "production") {
Perf = require("react-addons-perf")
window.Perf = Perf
ReactPerfTool = require("react-perf-tool")
require("react-perf-tool/lib/styles.css")
}
export default class App extends React.Component {
getLayout() {
@@ -14,7 +24,10 @@ export default class App extends React.Component {
const Layout = this.getLayout()
return (
<Layout/>
<div>
<Layout/>
<ReactPerfTool perf={Perf} />
</div>
)
}
}

View File

@@ -6,11 +6,6 @@ import ApisPreset from "core/presets/apis"
import * as AllPlugins from "core/plugins/all"
import { parseSearch } from "core/utils"
if (process.env.NODE_ENV !== "production") {
const Perf = require("react-addons-perf")
window.Perf = Perf
}
// eslint-disable-next-line no-undef
const { GIT_DIRTY, GIT_COMMIT, PACKAGE_VERSION, HOSTNAME, BUILD_TIME } = buildInfo