Skip to content

Commit

Permalink
breaking: Remove fallback flow for Metro config defaults (0.73)
Browse files Browse the repository at this point in the history
  • Loading branch information
huntie committed Jun 15, 2023
1 parent 4650a8d commit d09859e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 100 deletions.
87 changes: 0 additions & 87 deletions packages/cli-plugin-metro/src/tools/getDefaultMetroConfig.ts

This file was deleted.

17 changes: 4 additions & 13 deletions packages/cli-plugin-metro/src/tools/loadMetroConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import {
} from 'metro-config';
import {CLIError, logger} from '@react-native-community/cli-tools';
import type {Config} from '@react-native-community/cli-types';
import getDefaultMetroConfig from './getDefaultMetroConfig';
import {reactNativePlatformResolver} from './metroPlatformResolver';

export type {Config};
Expand Down Expand Up @@ -97,24 +96,16 @@ export default async function loadMetroConfig(

if (
!/['"']@react-native\/metro-config['"']/.test(
fs.readFileSync(projectConfig.filepath, 'utf8'),
fs
// @ts-ignore resolveConfig return value is mistyped
.readFileSync(projectConfig.filepath, 'utf8'),
)
) {
logger.warn(
'From React Native 0.72, your metro.config.js file should extend' +
"'@react-native/metro-config'. Please see the React Native 0.72 " +
'changelog, or copy the template at:\n' +
"'@react-native/metro-config'. Please copy the template at:\n" +
'https://github.com/facebook/react-native/blob/main/packages/react-native/template/metro.config.js',
);
logger.warn('Falling back to internal defaults.');

const loadedConfig = await loadConfig(
{cwd: ctx.root, ...options},
// Provide React Native defaults on top of Metro defaults
getDefaultMetroConfig(ctx),
);

return mergeConfig(loadedConfig, overrideConfig);
}

return mergeConfig(
Expand Down

0 comments on commit d09859e

Please sign in to comment.