From 39d9d71adbb77eff543fe442bd3061edc9858dd6 Mon Sep 17 00:00:00 2001 From: Rafael Oleza Date: Tue, 12 Jun 2018 13:43:47 -0700 Subject: [PATCH] Expose getResolverMainFields() config param Reviewed By: mjesun Differential Revision: D8380198 fbshipit-source-id: 3d5b7a5873095db2b90a23b5054fb94579df3f1a --- local-cli/bundle/buildBundle.js | 1 + local-cli/server/runServer.js | 1 + local-cli/util/Config.js | 5 +++-- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/local-cli/bundle/buildBundle.js b/local-cli/bundle/buildBundle.js index b6ad5a551..818ddec9c 100644 --- a/local-cli/bundle/buildBundle.js +++ b/local-cli/bundle/buildBundle.js @@ -88,6 +88,7 @@ async function buildBundle( extraNodeModules: config.extraNodeModules, getModulesRunBeforeMainModule: config.getModulesRunBeforeMainModule, getPolyfills: config.getPolyfills, + getResolverMainFields: config.getResolverMainFields, getRunModuleStatement: config.getRunModuleStatement, getTransformOptions: config.getTransformOptions, hasteImplModulePath: config.hasteImplModulePath, diff --git a/local-cli/server/runServer.js b/local-cli/server/runServer.js index ed2af28da..0bd092cf4 100644 --- a/local-cli/server/runServer.js +++ b/local-cli/server/runServer.js @@ -187,6 +187,7 @@ function getPackagerServer(args, config, reporter) { dynamicDepsInPackages: config.dynamicDepsInPackages, getModulesRunBeforeMainModule: config.getModulesRunBeforeMainModule, getPolyfills: config.getPolyfills, + getResolverMainFields: config.getResolverMainFields, getRunModuleStatement: config.getRunModuleStatement, getTransformOptions: config.getTransformOptions, hasteImplModulePath: config.hasteImplModulePath, diff --git a/local-cli/util/Config.js b/local-cli/util/Config.js index fc996aa06..bc7ba4716 100644 --- a/local-cli/util/Config.js +++ b/local-cli/util/Config.js @@ -73,11 +73,12 @@ const Config = { DEFAULT: ({ ...MetroConfig.DEFAULT, getBlacklistRE, - getProjectRoots, - getPolyfills, getModulesRunBeforeMainModule: () => [ require.resolve('../../Libraries/Core/InitializeCore'), ], + getProjectRoots, + getPolyfills, + getResolverMainFields: () => ['react-native', 'browser', 'main'], getTransformModulePath: () => require.resolve('metro/src/reactNativeTransformer'), }: ConfigT),