Skip to content

Commit 7165558

Browse files
authored
fix: Fix loading Metro config from alternative config path (#2043)
1 parent 588753c commit 7165558

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

packages/cli-plugin-metro/src/tools/loadMetroConfig.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,11 @@ export default async function loadMetroConfig(
9292
overrideConfig.reporter = options.reporter;
9393
}
9494

95-
const projectConfig = await resolveConfig(undefined, ctx.root);
95+
const cwd = ctx.root;
96+
const projectConfig = await resolveConfig(options.config, cwd);
9697

9798
if (projectConfig.isEmpty) {
98-
throw new CLIError(`No metro config found in ${ctx.root}`);
99+
throw new CLIError(`No Metro config found in ${cwd}`);
99100
}
100101

101102
logger.debug(`Reading Metro config from ${projectConfig.filepath}`);
@@ -119,7 +120,10 @@ This warning will be removed in future (https://github.com/facebook/metro/issues
119120
}
120121

121122
return mergeConfig(
122-
await loadConfig({cwd: ctx.root, ...options}),
123+
await loadConfig({
124+
cwd,
125+
...options,
126+
}),
123127
overrideConfig,
124128
);
125129
}

0 commit comments

Comments
 (0)