Adds `process.env.NODE_ENV` polyfill
Summary: There are many libraries that use `NODE_ENV` to check whether the code is running in "production" mode or not. This allows those library authors to not have to add conditionals for React Native. One such library is Redux: https://github.com/gaearon/react-redux/pull/40 Thanks to @brentvatne for providing the solution via this tweet (via his phone in the airport 😉): https://twitter.com/notbrent/status/630440250951749632 /cc @vjeux @gaearon @zpao @amasad Closes https://github.com/facebook/react-native/pull/2279 Github Author: Dave Sibiski <dsibiski@gmail.com>
This commit is contained in:
parent
a303a42e28
commit
e163df3567
|
@ -129,6 +129,10 @@ function setupProfile() {
|
||||||
require('BridgeProfiling').swizzleReactPerf();
|
require('BridgeProfiling').swizzleReactPerf();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function setUpProcessEnv() {
|
||||||
|
GLOBAL.process = {env: {NODE_ENV: __DEV__ ? 'development' : 'production'}};
|
||||||
|
}
|
||||||
|
|
||||||
setUpRedBoxErrorHandler();
|
setUpRedBoxErrorHandler();
|
||||||
setUpTimers();
|
setUpTimers();
|
||||||
setUpAlert();
|
setUpAlert();
|
||||||
|
@ -138,3 +142,4 @@ setUpRedBoxConsoleErrorHandler();
|
||||||
setUpGeolocation();
|
setUpGeolocation();
|
||||||
setUpWebSockets();
|
setUpWebSockets();
|
||||||
setupProfile();
|
setupProfile();
|
||||||
|
setUpProcessEnv();
|
||||||
|
|
Loading…
Reference in New Issue