Skip to content

Commit

Permalink
fix: config.reporter undefined bug (#376)
Browse files Browse the repository at this point in the history
* fix: config.reporter undefined bug

* refactor

* Update loadMetroConfig.js
  • Loading branch information
yinhangfeng authored and thymikee committed May 15, 2019
1 parent a41b7a3 commit 6fb96af
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions packages/cli/src/tools/loadMetroConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,18 @@ export type ConfigOptionsT = {|
*/
export default function load(ctx: ConfigT, options?: ConfigOptionsT) {
const defaultConfig = getDefaultConfig(ctx);
return loadConfig(
{cwd: ctx.root, ...options},
{...defaultConfig, reporter: options && options.reporter},
);
if (options && options.reporter) {
/**
* $FlowIssue: Metro doesn't accept `reporter` to be passed along other options
* and will ignore the value, if provided.
*
* We explicitly read `reporter` value and set it on a default configuration. Note
* that all other options described in the `ConfigOptionsT` are handled by Metro
* automatically.
*
* This is a temporary workaround.
*/
defaultConfig.reporter = options.reporter;
}
return loadConfig({cwd: ctx.root, ...options}, defaultConfig);
}

0 comments on commit 6fb96af

Please sign in to comment.