Change react-native config loading to provide an override for the default config.

Summary:
Instead of overriding the config at the end we now do it right after applying default
config and before the user config is applied.

Reviewed By: rafeca

Differential Revision: D9131758

fbshipit-source-id: 15e575fc11a781187f3ee2fa7cf81c227cf6a088
This commit is contained in:
Ives van Hoorne 2018-08-02 05:22:57 -07:00 committed by Facebook Github Bot
parent b91184885f
commit 140b230e84
1 changed files with 3 additions and 4 deletions

View File

@ -14,7 +14,7 @@ const getPolyfills = require('../../rn-get-polyfills');
const path = require('path'); const path = require('path');
const {createBlacklist} = require('metro'); const {createBlacklist} = require('metro');
const {loadConfig, mergeConfig} = require('metro-config'); const {loadConfig} = require('metro-config');
/** /**
* Configuration file of the CLI. * Configuration file of the CLI.
@ -85,11 +85,10 @@ const Config = {
getProjectRoots, getProjectRoots,
async load(configFile: ?string): Promise<ConfigT> { async load(configFile: ?string): Promise<ConfigT> {
const config: ConfigT = await loadConfig( return await loadConfig(
configFile ? {config: configFile} : {}, configFile ? {config: configFile} : {},
this.DEFAULT,
); );
return mergeConfig(config, this.DEFAULT);
}, },
}; };