@samitouri / QOS-React / commits / f92343159d

Wrap "warning" call in DEV block to prevent PROD error (#10295)

* re-adds warning module to FB PROD bundle * Wrap the warning call too

Dominic Gannaway committed Jul 26, 2017 at 14:59 UTC f92343159dc26fe8fb7b3bbd4801cbc202d70e04
1 file changed +7 -5
src/renderers/shared/fiber/ReactFiberDevToolsHook.js
+7 -5
@@ -12,15 +12,15 @@
12
13 'use strict';
14
15 -if (__DEV__) {
16 - var warning = require('fbjs/lib/warning');
17 -}
18 -
15 import type {Fiber} from 'ReactFiber';
16 import type {FiberRoot} from 'ReactFiberRoot';
17
18 declare var __REACT_DEVTOOLS_GLOBAL_HOOK__: Object | void;
19
20 +if (__DEV__) {
21 + var warning = require('fbjs/lib/warning');
22 +}
23 +
24 let rendererID = null;
25 let injectInternals = null;
26 let onCommitRoot = null;
@@ -36,7 +36,9 @@ if (
36 } = __REACT_DEVTOOLS_GLOBAL_HOOK__;
37
38 injectInternals = function(internals: Object) {
39 - warning(rendererID == null, 'Cannot inject into DevTools twice.');
39 + if (__DEV__) {
40 + warning(rendererID == null, 'Cannot inject into DevTools twice.');
41 + }
42 rendererID = inject(internals);
43 };
44