mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
161b910494
Summary: A few recent imports have explicitly added ".js" to the end of their path. This prevents Metro from resolving platform-specific JS files, e.g. "Foo.android.js" or "Foo.windows.js" instead of "Foo.js". React Native Windows provides its own implementation of files in a few cases where stock React Native will share them between Android and iOS. We hope to reduce/eliminate these long term, but requiring explicit ".js" files currently breaks us in a couple of places where we have custom implementations. This change is a quick regex replace of ES6 and CommonJS imports in 'Libraries/" to eliminate ".js". ## Changelog [General] [Fixed] - Do not explicitly include ".js" in Library imports Pull Request resolved: https://github.com/facebook/react-native/pull/28311 Test Plan: I haven't done any manual validation of this, but `flow-check` should catch any issues with this during CI. Reviewed By: cpojer Differential Revision: D20486466 Pulled By: TheSavior fbshipit-source-id: 31e1ccc307967417d7d09c34c859f0b2b69eac84
26 lines
1007 B
JavaScript
26 lines
1007 B
JavaScript
/**
|
|
* Copyright (c) Facebook, Inc. and its 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
|
|
*/
|
|
|
|
import type {ErrorUtilsT} from '../../polyfills/error-guard';
|
|
|
|
/**
|
|
* The particular require runtime that we are using looks for a global
|
|
* `ErrorUtils` object and if it exists, then it requires modules with the
|
|
* error handler specified via ErrorUtils.setGlobalHandler by calling the
|
|
* require function with applyWithGuard. Since the require module is loaded
|
|
* before any of the modules, this ErrorUtils must be defined (and the handler
|
|
* set) globally before requiring anything.
|
|
*
|
|
* However, we still want to treat ErrorUtils as a module so that other modules
|
|
* that use it aren't just using a global variable, so simply export the global
|
|
* variable here. ErrorUtils is originally defined in a file named error-guard.js.
|
|
*/
|
|
module.exports = (global.ErrorUtils: ErrorUtilsT);
|