diff --git a/local-cli/core/index.js b/local-cli/core/index.js index 5973fbf53..4b05093e2 100644 --- a/local-cli/core/index.js +++ b/local-cli/core/index.js @@ -14,6 +14,7 @@ const Config = require('../util/Config'); const defaultConfig = require('./default.config'); const minimist = require('minimist'); +const path = require('path'); import type {CommandT} from '../commands'; import type {ConfigT} from '../util/Config'; @@ -40,7 +41,7 @@ export type RNConfig = { function getCliConfig(): RNConfig { const cliArgs = minimist(process.argv.slice(2)); const config = cliArgs.config != null - ? Config.loadFile(cliArgs.config, __dirname) + ? Config.loadFile(path.resolve(__dirname, cliArgs.config)) : Config.findOptional(__dirname); return {...defaultConfig, ...config}; diff --git a/local-cli/util/Config.js b/local-cli/util/Config.js index dd86297f8..68b91eb60 100644 --- a/local-cli/util/Config.js +++ b/local-cli/util/Config.js @@ -122,15 +122,9 @@ const Config = { : {...defaultConfig}; }, - loadFile( - pathToConfig: string, - cwd: string, - ): ConfigT { - const config: {} = path.isAbsolute(pathToConfig) ? - // $FlowFixMe nope - require(pathToConfig) : - // $FlowFixMe nope - require(path.join(cwd, pathToConfig)); + loadFile(pathToConfig: string): ConfigT { + //$FlowFixMe: necessary dynamic require + const config: {} = require(pathToConfig); return {...defaultConfig, ...config}; }, };