Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions packages/cli-plugin-metro/src/tools/loadMetroConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ export type ConfigLoadingContext = Pick<
'root' | 'reactNativePath' | 'platforms'
>;

declare global {
var __REACT_NATIVE_METRO_CONFIG_LOADED: boolean;
}

/**
* Get the config options to override based on RN CLI inputs.
*/
Expand Down Expand Up @@ -98,6 +102,9 @@ export default async function loadMetroConfig(
logger.debug(`Reading Metro config from ${projectConfig.filepath}`);

if (
!global.__REACT_NATIVE_METRO_CONFIG_LOADED &&
// TODO(huntie): Remove this check from 0.73 onwards (all users will be on
// the next major @react-native/metro-config version)
!/['"']@react-native\/metro-config['"']/.test(
fs.readFileSync(projectConfig.filepath, 'utf8'),
)
Expand Down