diff --git a/packages/metro/src/Config.js b/packages/metro/src/Config.js index b22988fa..38252add 100644 --- a/packages/metro/src/Config.js +++ b/packages/metro/src/Config.js @@ -67,6 +67,12 @@ export type ConfigT = { */ getBlacklistRE(): RegExp, + /** + * Specify an implementation module to load async import modules (for + * splitting). + */ + getAsyncRequireModulePath(): string, + /** * Specify whether or not to enable Babel's behavior for looking up .babelrc * files. If false, only the .babelrc file (if one exists) in the main project @@ -175,6 +181,7 @@ const DEFAULT = ({ cacheStores: [], cacheVersion: '1.0', dynamicDepsInPackages: 'throwAtRuntime', + getAsyncRequireModulePath: () => 'metro/src/lib/bundle-modules/asyncRequire', getAssetExts: () => [], getBlacklistRE: () => blacklist(), getEnableBabelRCLookup: () => true, diff --git a/packages/metro/src/index.js b/packages/metro/src/index.js index 367818c2..1fdda74f 100644 --- a/packages/metro/src/index.js +++ b/packages/metro/src/index.js @@ -110,6 +110,7 @@ async function runMetro({ projectRoots: finalProjectRoots, }); const serverOptions: ServerOptions = { + asyncRequireModulePath: normalizedConfig.getAsyncRequireModulePath(), assetExts: normalizedConfig.assetTransforms ? [] : assetExts, assetRegistryPath: normalizedConfig.assetRegistryPath, blacklistRE: normalizedConfig.getBlacklistRE(), diff --git a/packages/metro/src/shared/types.flow.js b/packages/metro/src/shared/types.flow.js index 7741a898..693acaf6 100644 --- a/packages/metro/src/shared/types.flow.js +++ b/packages/metro/src/shared/types.flow.js @@ -78,7 +78,7 @@ export type Options = {| // TODO: Remove this option below (T23793920) assetTransforms?: boolean, assetExts?: Array, - +asyncRequireModulePath?: string, + +asyncRequireModulePath: string, +assetRegistryPath: string, blacklistRE?: RegExp, cacheStores: $ReadOnlyArray>,