From 716555851b442a83a1bf5e0db27b6226318c9a69 Mon Sep 17 00:00:00 2001 From: Alex Hunt Date: Mon, 7 Aug 2023 14:54:43 +0100 Subject: [PATCH] fix: Fix loading Metro config from alternative config path (#2043) --- 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 8c9e51e44..d9f7549bc 100644 --- a/packages/cli-plugin-metro/src/tools/loadMetroConfig.ts +++ b/packages/cli-plugin-metro/src/tools/loadMetroConfig.ts @@ -92,10 +92,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}`); @@ -119,7 +120,10 @@ This warning will be removed in future (https://github.com/facebook/metro/issues } return mergeConfig( - await loadConfig({cwd: ctx.root, ...options}), + await loadConfig({ + cwd, + ...options, + }), overrideConfig, ); }