Skip to content

Commit

Permalink
Include react-addons-perf for non-production builds
Browse files Browse the repository at this point in the history
This makes it possible to gather a few performance stats
  • Loading branch information
richvdh committed Apr 19, 2016
1 parent abca28c commit a0b460b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
"parallelshell": "^1.2.0",
"phantomjs-prebuilt": "^2.1.7",
"react-addons-test-utils": "^15.0.1",
"react-addons-perf": "^15.0",
"rimraf": "^2.4.3",
"source-map-loader": "^0.1.5",
"webpack": "^1.12.14"
Expand Down
9 changes: 8 additions & 1 deletion src/vector/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,15 @@ require('gemini-scrollbar/gemini-scrollbar.css');
require('gfm.css/gfm.css');
require('highlight.js/styles/github.css');


// add React and ReactPerf to the global namespace, to make them easier to
// access via the console
global.React = require("react");
if (process.env.NODE_ENV !== 'production') {
global.ReactPerf = require("react-addons-perf");
}

var RunModernizrTests = require("./modernizr"); // this side-effects a global
var React = require("react");
var ReactDOM = require("react-dom");
var sdk = require("matrix-react-sdk");
sdk.loadSkin(require('../component-index'));
Expand Down
1 change: 1 addition & 0 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ module.exports = {
// alias any requires to the react module to the one in our path, otherwise
// we tend to get the react source included twice when using npm link.
react: path.resolve('./node_modules/react'),
"react-addons-perf": path.resolve('./node_modules/react-addons-perf'),

// same goes for js-sdk
"matrix-js-sdk": path.resolve('./node_modules/matrix-js-sdk'),
Expand Down

0 comments on commit a0b460b

Please sign in to comment.