react-native icon indicating copy to clipboard operation
react-native copied to clipboard

[LOCAL] fix(cli,metro,babel): bump cli and metro and babel to fix Windows+Metro issue

Open kelset opened this issue 2 years ago • 6 comments

Summary

Local 71 PR to bump necessary packages to address an issue we found on Windows with Metro.

Basically, the issue is as follows (from @robhogan's great report)

Git Bash users on Windows who don't have Watchman installed will experience "Unable to resolve" red boxes, because Metro silently doesn't discover any files. This will affect both new and existing projects with default settings.

This has been addressed via patch release of Metro 0.73.7, which requires a bump of CLI too. So this PR was made https://github.com/react-native-community/cli/pull/1787 that led to this CLI release: https://github.com/react-native-community/cli/releases/tag/v10.1.0

Problem is that if we only bump Metro and CLI to these new versions in 0.71 branch, yarn install gets thrown into an infinite loop that errors out with a OOM error.

The root cause seems to be related to the fact that between 0.73.5 and 0.73.7, babel was bumped to 7.20, as you can see here https://github.com/facebook/metro/compare/v0.73.5...v0.73.7#files_bucket

By doing the minimal amount of babel bumps (we need a more well done babel-deps alignment in main branch), this is addressed and yarn install works correctly. This PR is it.

Opening as a PR and not a straight commit because I want to make sure we can discuss if we want to merge this before 0.71.0 or since it's more work than expected, it'd be better to wait for 0.71.1 when we can test things more carefully.

Changelog

[GENERAL] [CHANGED] - Bump CLI to 10.1.0, Metro to 0.73.7, Babel to ^7.20.0

Test Plan

CI is green.

kelset avatar Jan 06 '23 10:01 kelset

Warnings
:warning: :lock: package.json - Changes were made to package.json. This will require a manual import by a Facebook employee.
:warning:

scripts/run-ci-e2e-tests.js#L22 - scripts/run-ci-e2e-tests.js line 22 – 'rm' is assigned a value but never used. (no-unused-vars)

Generated by :no_entry_sign: dangerJS against 24d4e22f87000914aeea993d4f910af147bd8f63

github-actions[bot] avatar Jan 06 '23 10:01 github-actions[bot]

As a bit of context on the Babel updates, there is some value there - the update fixes a @babel/parser bug that some people were running into on upgrading RN in an existing project: https://github.com/facebook/react-native/issues/34719#issuecomment-1337228423

Problem is that if we only bump Metro and CLI to these new versions in 0.71 branch, yarn install gets thrown into an infinite loop that errors out with a OOM error.

👀!

robhogan avatar Jan 06 '23 11:01 robhogan

@cortinico / @cipolleschi I guess the 0.71.0 release is imminent, are we targeting this fix for 0.71.1?

robhogan avatar Jan 09 '23 14:01 robhogan

@cortinico / @cipolleschi I guess the 0.71.0 release is imminent, are we targeting this fix for 0.71.1?

yeah that's the plan at the moment, since this PR bumps babel too so it needed to be a bit more looked into

kelset avatar Jan 09 '23 15:01 kelset

The test_js failure here looks like mostly snapshot changes (due to benign changes in the formatting of Babel's output) plus some issue I don't immediately understand with resolving @babel/preset-flow in a test.

motiz88 avatar Jan 09 '23 17:01 motiz88

The test_js failure here looks like mostly snapshot changes (due to benign changes in the formatting of Babel's output) plus some issue I don't immediately understand with resolving @babel/preset-flow in a test.

remember that this PR is on the 0.71-stable branch, so the fact that CI gets funky is most likely (also) related to that

kelset avatar Jan 10 '23 10:01 kelset