[RNTester] Correctly specify React Native dependency #2065
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Please select one of the following
Summary:
After #2030 landed, running
yarn start
(an alias ofreact-native start
) inpackages/rn-tester
leads to this error:This seems to be because Yarn 4 is much stricter about only using declared dependencies as compared to Yarn 1, and RNTester's package.json only specifies react-native as a peer dependency (a
"*"
at that!):What we want is tell RNTester ( a private package that will never be published) to use the workspace copy of react-native, rather than download from NPM. Luckily, modern package managers have the
workspace:*
syntax for exactly that! Let's update our package.json. I also had to specifyreact-native-macos
as the dependency instead of react-native.This fix won't work upstream in React Native, where yarn 1 doesn't support
workspace:*
, and the version needs to update for every nightly / stable release. I have prepared a separate fix there: facebook#42756Changelog:
[INTERNAL] [FIXED] - Fix running
react-native start
in rn-tester with yarn 4Test Plan:
CI should pass.