Files
react-native/Libraries/Core/InitializeCore.js
T
Rick Hanlon af0e6cdae5 Fix error reporting for module errors (#34650)
Summary:
Addresses some of https://github.com/facebook/react-native/issues/34649

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->

[General] [Fixed] - Error reporting for module errors

Pull Request resolved: https://github.com/facebook/react-native/pull/34650

Test Plan:
### Before

<img width="1728" alt="Screen Shot 2022-09-08 at 10 01 17 AM" src="https://user-images.githubusercontent.com/2440089/189425932-783b857d-59d3-4979-aecc-3de9d5bc6b0a.png">

### After

<img width="1728" alt="Screen Shot 2022-09-09 at 2 35 13 PM" src="https://user-images.githubusercontent.com/2440089/189425885-112130f4-aebd-4d84-b6c4-19b4dbb907e8.png">

Reviewed By: mdvacca

Differential Revision: D39395369

Pulled By: rickhanlonii

fbshipit-source-id: f60882e0fefbd3eb8481d251556afe5cda60c034
2022-10-19 16:37:39 -07:00

57 lines
1.6 KiB
JavaScript

/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @format
* @flow strict-local
*/
/**
* Sets up global variables typical in most JavaScript environments.
*
* 1. Global timers (via `setTimeout` etc).
* 2. Global console object.
* 3. Hooks for printing stack traces with source maps.
*
* Leaves enough room in the environment for implementing your own:
*
* 1. Require system.
* 2. Bridged modules.
*
*/
'use strict';
const start = Date.now();
require('./setUpGlobals');
require('./setUpPerformance');
require('./setUpErrorHandling');
require('./polyfillPromise');
require('./setUpRegeneratorRuntime');
require('./setUpTimers');
require('./setUpXHR');
require('./setUpAlert');
require('./setUpNavigator');
require('./setUpBatchedBridge');
require('./setUpSegmentFetcher');
if (__DEV__) {
require('./checkNativeVersion');
require('./setUpDeveloperTools');
require('../LogBox/LogBox').install();
}
require('../ReactNative/AppRegistry');
const GlobalPerformanceLogger = require('../Utilities/GlobalPerformanceLogger');
// We could just call GlobalPerformanceLogger.markPoint at the top of the file,
// but then we'd be excluding the time it took to require the logger.
// Instead, we just use Date.now and backdate the timestamp.
GlobalPerformanceLogger.markPoint(
'initializeCore_start',
GlobalPerformanceLogger.currentTimestamp() - (Date.now() - start),
);
GlobalPerformanceLogger.markPoint('initializeCore_end');