Do not override `metro.config.js` settings (#20705)

Summary:
React Native overrides the `metro.config.js` settings for, e.g., `hasteImplModulePath`, which prevents us from adding a `metro.config.js` file to the repo for `react-native-windows` to allow us to resolve Haste modules at the top-level of the repo. This change ensures that if a user has a `metro.config.js` file, those settings are not overwritten by React Native.
Pull Request resolved: https://github.com/facebook/react-native/pull/20705

Differential Revision: D9390146

Pulled By: hramos

fbshipit-source-id: 5ccc137490410ace72d7b0e68f2bafcbb233c59f
This commit is contained in:
Eric Rozell 2018-08-18 05:18:44 -07:00 committed by Facebook Github Bot
parent 735be8b24d
commit c5297c75cb
1 changed files with 3 additions and 3 deletions

View File

@ -132,9 +132,9 @@ async function getCliConfig(): Promise<RNConfig> {
);
config.transformer.assetRegistryPath = ASSET_REGISTRY_PATH;
config.resolver.hasteImplModulePath = defaultConfig.hasteImplModulePath;
config.resolver.platforms = defaultConfig.getPlatforms();
config.resolver.providesModuleNodeModules = defaultConfig.getProvidesModuleNodeModules();
config.resolver.hasteImplModulePath = config.resolver.hasteImplModulePath || defaultConfig.hasteImplModulePath;
config.resolver.platforms = config.resolver.platforms || defaultConfig.getPlatforms();
config.resolver.providesModuleNodeModules = config.resolver.providesModuleNodeModules || defaultConfig.getProvidesModuleNodeModules();
return {...defaultRNConfig, ...config};
}