mirror of https://github.com/status-im/metro.git
metro-bundler: Resolver: explicit option list
Summary: I appears `Object.assign` is not properly typed-checked by Flow, and silently so, so I propose we switch to an explicit list until we find an alternative solution. I prefer to have strong typing especially for options, and as the lack of typing has caused breakage before. Reviewed By: cpojer Differential Revision: D5442319 fbshipit-source-id: 82b0ec760c7dea6da6f7932896243147ce12ebf9
This commit is contained in:
parent
f58a9fa922
commit
be9219b852
|
@ -70,19 +70,31 @@ class Resolver {
|
|||
}
|
||||
|
||||
static async load(opts: Options): Promise<Resolver> {
|
||||
const depGraphOpts = Object.assign(Object.create(opts), {
|
||||
const depGraphOpts = {
|
||||
assetDependencies: ['react-native/Libraries/Image/AssetRegistry'],
|
||||
assetExts: opts.assetExts,
|
||||
extraNodeModules: opts.extraNodeModules,
|
||||
forceNodeFilesystemAPI: false,
|
||||
getTransformCacheKey: opts.getTransformCacheKey,
|
||||
globalTransformCache: opts.globalTransformCache,
|
||||
ignoreFilePath: opts.blacklistRE || / ^/ /* matches nothing */,
|
||||
maxWorkers: opts.maxWorkers,
|
||||
moduleOptions: {
|
||||
hasteImpl: opts.hasteImpl,
|
||||
resetCache: opts.resetCache,
|
||||
transformCache: opts.transformCache,
|
||||
},
|
||||
platforms: opts.platforms,
|
||||
preferNativePlatform: true,
|
||||
providesModuleNodeModules: opts.providesModuleNodeModules,
|
||||
reporter: opts.reporter,
|
||||
resetCache: opts.resetCache,
|
||||
roots: opts.projectRoots,
|
||||
sourceExts: opts.sourceExts,
|
||||
transformCode: opts.transformCode,
|
||||
useWatchman: true,
|
||||
});
|
||||
watch: opts.watch,
|
||||
};
|
||||
const depGraph = await DependencyGraph.load(depGraphOpts);
|
||||
return new Resolver(opts, depGraph);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue