Uh oh!
There was an error while loading. Please reload this page.
fix: Add runtime error when Metro config cannot be resolved - #1889
Conversation
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
szymonrybczak
commented
Mar 27, 2023
Thanks for the fix 🎉 I see that you changed the command from direct call |
huntie
commented
Mar 27, 2023
@szymonrybczak Yes! This PR is basically a test plan for that |
Cool! So in future we can get rid of |
huntie
commented
Mar 28, 2023
Updated to address feedback. Ready to merge. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Hi folks, can we pick this into |
Summary: Related: react-native-community/cli#1889. Changelog: **[Types]** Fix return type on `'metro-config'.resolveConfig` Reviewed By: motiz88 Differential Revision: D44540075 fbshipit-source-id: 182c3d7ac3c75446a905cb2988bef8044dea2a76
zhiqingchen
commented
Jul 19, 2023
hi @huntie if(options.reporter){overrideConfig.reporter=options.reporter;}loadConfig() already set reporter from options loadConfig({cwd: ctx.root, ...options}) |
Summary:
Relates to:
While preparing react/react-native#36623, we discovered that (post monorepo) a few scripts in the React Native repo were starting RN CLI in directories outside of the project dir and weren't reading
metro.config.jsas expected — printing obscure errors due to missing config items.This PR updates the CLI to throw a runtime error when
resolveConfigfails for the target working directory (ctx.root). This is an important DevX enhancement, since a completemetro.config.jsfile will be required from React Native 0.72.Test Plan:
Pre-steps:
yarn linkin local clone of RN CLI.yarn link @react-native-community/cli-plugin-metroinsidepackages/rn-tester(localfacebook/react-nativerepo clone).✅ Now throws for
yarn startinpackages/rn-tester.(Note: I'm open to suggestions for an improved error message/method of erroring to improve the CLI output.)
✅ Does not throw when
yarn startcommand is fixedconsole.log()to print the config file name)