Expose the asyncRequireModulePath param

Reviewed By: mjesun

Differential Revision: D7709569

fbshipit-source-id: 871dd9c178b1e5c81163558201ef983315561211
This commit is contained in:
Rafael Oleza 2018-04-20 14:03:33 -07:00 committed by Facebook Github Bot
parent 87e3ce281a
commit e11dddd141
3 changed files with 9 additions and 1 deletions

View File

@ -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,

View File

@ -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(),

View File

@ -78,7 +78,7 @@ export type Options = {|
// TODO: Remove this option below (T23793920)
assetTransforms?: boolean,
assetExts?: Array<string>,
+asyncRequireModulePath?: string,
+asyncRequireModulePath: string,
+assetRegistryPath: string,
blacklistRE?: RegExp,
cacheStores: $ReadOnlyArray<CacheStore<TransformedCode>>,