mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-01-30 22:48:23 +08:00
Set up the RN JS environment before requiring other modules
Summary: Set up the polyfills for console and process before initializing other modules. Some modules do work (e.g. call `invariant`) when they are first required, so requiring the DefaultInjection module at the beginning ensures we have a consistent JS environment. Closes https://github.com/facebook/react-native/pull/3526 Reviewed By: spicyj Differential Revision: D2560340 Pulled By: frantic fb-gh-sync-id: 44c743e3212ff1dcdbe0169041dfd3ea8f1a54f7
This commit is contained in:
committed by
facebook-github-bot-0
parent
251a4086a7
commit
6ec4d65aec
@@ -22,10 +22,6 @@
|
||||
/* eslint strict: 0 */
|
||||
/* globals GLOBAL: true, window: true */
|
||||
|
||||
// Just to make sure the JS gets packaged up.
|
||||
require('RCTDebugComponentOwnership');
|
||||
require('RCTDeviceEventEmitter');
|
||||
require('PerformanceLogger');
|
||||
require('regenerator/runtime');
|
||||
|
||||
if (typeof GLOBAL === 'undefined') {
|
||||
@@ -184,6 +180,7 @@ function setUpNumber() {
|
||||
Number.MIN_SAFE_INTEGER = Number.MIN_SAFE_INTEGER || -(Math.pow(2, 53) - 1);
|
||||
}
|
||||
|
||||
setUpProcessEnv();
|
||||
setUpRedBoxErrorHandler();
|
||||
setUpTimers();
|
||||
setUpAlert();
|
||||
@@ -193,6 +190,11 @@ setUpRedBoxConsoleErrorHandler();
|
||||
setUpGeolocation();
|
||||
setUpWebSockets();
|
||||
setUpProfile();
|
||||
setUpProcessEnv();
|
||||
setUpFlowChecker();
|
||||
setUpNumber();
|
||||
|
||||
// Just to make sure the JS gets packaged up. Wait until the JS environment has
|
||||
// been initialized before requiring them.
|
||||
require('RCTDebugComponentOwnership');
|
||||
require('RCTDeviceEventEmitter');
|
||||
require('PerformanceLogger');
|
||||
|
||||
Reference in New Issue
Block a user