Skip to content

Commit caff20c

Browse files
committed
Merge pull request element-hq#1431 from vector-im/rav/reactperf
Include react-addons-perf for non-production builds
2 parents e71ca32 + a0b460b commit caff20c

3 files changed

Lines changed: 10 additions & 1 deletion

File tree

‎package.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@
7373
"parallelshell": "^1.2.0",
7474
"phantomjs-prebuilt": "^2.1.7",
7575
"react-addons-test-utils": "^15.0.1",
76+
"react-addons-perf": "^15.0",
7677
"rimraf": "^2.4.3",
7778
"source-map-loader": "^0.1.5",
7879
"webpack": "^1.12.14"

‎src/vector/index.js‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,15 @@ require('gemini-scrollbar/gemini-scrollbar.css');
2727
require('gfm.css/gfm.css');
2828
require('highlight.js/styles/github.css');
2929

30+
31+
// add React and ReactPerf to the global namespace, to make them easier to
32+
// access via the console
33+
global.React = require("react");
34+
if (process.env.NODE_ENV !== 'production') {
35+
global.ReactPerf = require("react-addons-perf");
36+
}
37+
3038
var RunModernizrTests = require("./modernizr"); // this side-effects a global
31-
var React = require("react");
3239
var ReactDOM = require("react-dom");
3340
var sdk = require("matrix-react-sdk");
3441
sdk.loadSkin(require('../component-index'));

‎webpack.config.js‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ module.exports = {
4141
// alias any requires to the react module to the one in our path, otherwise
4242
// we tend to get the react source included twice when using npm link.
4343
react: path.resolve('./node_modules/react'),
44+
"react-addons-perf": path.resolve('./node_modules/react-addons-perf'),
4445

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

0 commit comments

Comments
 (0)