Perf Is Not Defined - Running React App With Webpack-dev-server

I am trying to measure react performance with Perf addon, but when I'm trying to run Perf.start() in my console i get an error: Uncaught ReferenceError: Perf is not defined(…)

Worth mentioning, that I've installed the plugin through npm and have a require('react-addons-perf') sitting in my main.js file.

I have a guess that this problem related to the fact that i'm running a webpack-dev-server and the global variable is not properly exposed, but unfortunately hav no idea, how to properly approach it. Can anyone help me with that?

Here's my webpack.config file contents on codepen for the reference.



I don't know if there might be changes within your webpack.config that could change the scoping or expose a var to be accessible via the global scope, but one quick way would be to simply use

global.Perf = require('react-addons-perf');

This should grant you access via console.

But one must say that it is maybe not intended to expose vars globally global variables in requireJS

And maybe try to find a way to trigger the Perf.start() and Perf.stop() from within your code, not the console!