From 2ed814466b56c455338e9b7c07bf608389f495f5 Mon Sep 17 00:00:00 2001 From: Alex Hunt Date: Wed, 2 Aug 2023 11:26:30 +0100 Subject: [PATCH] fix: Fix loading Metro config from alternative config path (11.x) --- packages/cli-plugin-metro/src/tools/loadMetroConfig.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/packages/cli-plugin-metro/src/tools/loadMetroConfig.ts b/packages/cli-plugin-metro/src/tools/loadMetroConfig.ts index 961ba1ec9..847dc8f5b 100644 --- a/packages/cli-plugin-metro/src/tools/loadMetroConfig.ts +++ b/packages/cli-plugin-metro/src/tools/loadMetroConfig.ts @@ -94,10 +94,11 @@ export default async function loadMetroConfig( overrideConfig.reporter = options.reporter; } - const projectConfig = await resolveConfig(undefined, ctx.root); + const cwd = ctx.root; + const projectConfig = await resolveConfig(options.config, cwd); if (projectConfig.isEmpty) { - throw new CLIError(`No metro config found in ${ctx.root}`); + throw new CLIError(`No Metro config found in ${cwd}`); } logger.debug(`Reading Metro config from ${projectConfig.filepath}`); @@ -128,7 +129,10 @@ export default async function loadMetroConfig( } return mergeConfig( - await loadConfig({cwd: ctx.root, ...options}), + await loadConfig({ + cwd, + ...options, + }), overrideConfig, ); }