diff --git a/src/renderers/shared/fiber/ReactFiberDevToolsHook.js b/src/renderers/shared/fiber/ReactFiberDevToolsHook.js index dbf88b83492..dd01eb4d070 100644 --- a/src/renderers/shared/fiber/ReactFiberDevToolsHook.js +++ b/src/renderers/shared/fiber/ReactFiberDevToolsHook.js @@ -23,6 +23,24 @@ let rendererID = null; let injectInternals = null; let onCommitRoot = null; let onCommitUnmount = null; + +// A dummy function to check for minification during runtime +// Refer https://github.com/facebook/react-devtools/issues/694#issuecomment-300535376 +var testMinification = function testMinification() { + if (__DEV__) { + return 42; + } +}; + +warning( + (testMinification.name || testMinification.toString()) + .indexOf('testMinification') !== -1, + "It looks like you're using a minified copy of the development build " + + 'of React. When deploying React apps to production, make sure to use ' + + 'the production build which skips development warnings and is faster. ' + + 'See https://fb.me/react-minification for more details.', +); + if ( typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' && __REACT_DEVTOOLS_GLOBAL_HOOK__.supportsFiber @@ -35,7 +53,7 @@ if ( injectInternals = function(internals: Object) { warning(rendererID == null, 'Cannot inject into DevTools twice.'); - rendererID = inject(internals); + rendererID = inject(Object.assign({}, internals, {testMinification})); }; onCommitRoot = function(root: FiberRoot) {