Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/eslint-plugin-react-native/no-deep-imports.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ module.exports = {

return (
source.value === 'react-native/asset-registry' ||
source.value === 'react-native/async-require' ||
source.value === 'react-native/react-private-interface' ||
source.value === 'react-native/setup-env' ||
source.value === 'react-native/unstable-internals-do-not-use'
Expand Down
3 changes: 1 addition & 2 deletions packages/metro-config/src/index.flow.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,7 @@ export function getDefaultConfig(projectRoot: string): ConfigT {
transformer: {
allowOptionalDependencies: true,
assetRegistryPath: 'react-native/asset-registry',
asyncRequireModulePath:
require.resolve('metro-runtime/src/modules/asyncRequire'),
asyncRequireModulePath: 'react-native/async-require',
babelTransformerPath:
require.resolve('@react-native/metro-babel-transformer'),
getTransformOptions: async () => ({
Expand Down
4 changes: 4 additions & 0 deletions packages/react-native/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@
"types": null,
"default": "./src/asset-registry.js"
},
"./async-require": {
"types": null,
"default": "./src/async-require.js"
},
"./react-private-interface": {
"types": null,
"default": "./src/react-private-interface.js"
Expand Down
27 changes: 27 additions & 0 deletions packages/react-native/src/async-require.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/**
* 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.
*
* @flow strict-local
* @format
*/

'use strict';

// ----------------------------------------------------------------------------
// react-native/async-require
//
// This is an untyped secondary entry point intended to be referenced from
// Metro's `transformer.asyncRequireModulePath` config option. Metro inlines
// it into every module that uses `import()`, so it must be a module request
// that resolves from any module in the project.
//
// Apps/libraries should not import this module; use `import()` instead.
// ----------------------------------------------------------------------------

const asyncRequire = require('metro-runtime/src/modules/asyncRequire');

// eslint-disable-next-line @react-native/monorepo/no-commonjs-exports
module.exports = asyncRequire;
Loading