From 692293339e3b9f542f7b83c04bdccf46fef05766 Mon Sep 17 00:00:00 2001 From: Alex Hunt Date: Fri, 7 Jul 2023 07:57:21 -0700 Subject: [PATCH] Widen config search paths to include metro.config.cjs (#1027) Summary: Pull Request resolved: https://github.com/facebook/metro/pull/1027 Resolves https://github.com/facebook/metro/issues/1026. Changelog: **[Feature]** Widen config search paths to include `metro.config.cjs` Reviewed By: robhogan Differential Revision: D47290079 fbshipit-source-id: 3e46c954a1e1451558b14ed4558fede5f00200dd --- packages/metro-config/src/loadConfig.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/metro-config/src/loadConfig.js b/packages/metro-config/src/loadConfig.js index 011110cb54..22517d5714 100644 --- a/packages/metro-config/src/loadConfig.js +++ b/packages/metro-config/src/loadConfig.js @@ -46,13 +46,18 @@ function overrideArgument(arg: Array | T): T { } const explorer = cosmiconfig('metro', { - searchPlaces: ['metro.config.js', 'metro.config.json', 'package.json'], - + searchPlaces: [ + 'metro.config.js', + 'metro.config.cjs', + 'metro.config.json', + 'package.json', + ], loaders: { '.json': cosmiconfig.loadJson, '.yaml': cosmiconfig.loadYaml, '.yml': cosmiconfig.loadYaml, '.js': cosmiconfig.loadJs, + '.cjs': cosmiconfig.loadJs, '.es6': cosmiconfig.loadJs, noExt: cosmiconfig.loadYaml, },