From e61c12fe18d038dfd27164ed8befd4b4452979c6 Mon Sep 17 00:00:00 2001 From: Owen Conti Date: Sat, 19 Aug 2017 08:33:03 -0600 Subject: [PATCH] Move performance debugging tools to app.jsx --- src/core/components/app.jsx | 15 ++++++++++++++- src/core/index.js | 5 ----- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/core/components/app.jsx b/src/core/components/app.jsx index 9ef5a8fd..e701ba06 100644 --- a/src/core/components/app.jsx +++ b/src/core/components/app.jsx @@ -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 ( - +
+ + +
) } } diff --git a/src/core/index.js b/src/core/index.js index 9d9c0ac3..3dbcede4 100644 --- a/src/core/index.js +++ b/src/core/index.js @@ -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