mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-02-01 22:41:16 +08:00
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:
@@ -129,6 +129,10 @@ function setupProfile() {
|
||||
require('BridgeProfiling').swizzleReactPerf();
|
||||
}
|
||||
|
||||
function setUpProcessEnv() {
|
||||
GLOBAL.process = {env: {NODE_ENV: __DEV__ ? 'development' : 'production'}};
|
||||
}
|
||||
|
||||
setUpRedBoxErrorHandler();
|
||||
setUpTimers();
|
||||
setUpAlert();
|
||||
@@ -138,3 +142,4 @@ setUpRedBoxConsoleErrorHandler();
|
||||
setUpGeolocation();
|
||||
setUpWebSockets();
|
||||
setupProfile();
|
||||
setUpProcessEnv();
|
||||
|
||||
Reference in New Issue
Block a user