react-native/scripts
Rob Hogan 06fc6f2beb Use metro-babel-register for additive Babel registration (#45295)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45295

When registering Babel to run RN from source, we currently call `babel/register` directly from `scripts/babel-register.js`.

This has the effect of overwriting any previous registration, which causes problems in the FB monorepo because RN also loads other projects that lie outside this registration (like Metro) from source - possibly requiring different configurations.

Moreover, if Metro is subsequently loaded from source, its own registration clobbers RN's.

Instead, this diff runs the registration through `metro-babel-register`, which maintains a cumulative list of registration directories and applies a uniform transform.

Note that this means we're not using exactly the same transform at build/publish time as for running from source - to fix that, we ought to move everything to a central `babel.config.js`, but that's a much bigger change, and this gets us close enough to unblock.

Changelog: [Internal]

Reviewed By: hoxyq

Differential Revision: D59376984

fbshipit-source-id: 0dbb00970ac87dbe40ec8904bf51ef4b1fee5e0f
2024-07-05 04:48:30 -07:00
..
__tests__ Move all package.json updates into set-version script (#45180) 2024-06-26 07:59:49 -07:00
build Use metro-babel-register for additive Babel registration (#45295) 2024-07-05 04:48:30 -07:00
circleci Migrate analyse_code to GHA (#45247) 2024-07-03 05:49:47 -07:00
debugger-frontend Add --create-diff mode to debugger-frontend sync script (#43621) 2024-03-22 12:11:48 -07:00
e2e Port changes in the release testing script from the release branch (#45174) 2024-06-27 04:11:44 -07:00
monorepo Remove bump-all-updated-packages script (#43534) 2024-03-19 07:05:03 -07:00
release-testing Port changes in the release testing script from the release branch (#45174) 2024-06-27 04:11:44 -07:00
releases Rename set-rn-version script, mark as deprecated (#45184) 2024-06-26 10:14:12 -07:00
releases-ci Rename set-rn-version script, mark as deprecated (#45184) 2024-06-26 10:14:12 -07:00
utils Port changes in the release testing script from the release branch (#45174) 2024-06-27 04:11:44 -07:00
.tests.env Test against XCode 14.3 and 15 (#41798) 2023-12-05 15:35:05 -08:00
consts.js Fix RNTester Podfile.lock update in release workflow (#43513) 2024-03-15 10:32:07 -07:00
lint-java.js Enable lint/sort-imports everywhere (#41334) 2023-11-06 12:59:38 -08:00
npm-utils.js Move all package.json updates into set-version script (#45180) 2024-06-26 07:59:49 -07:00
objc-test.sh Port CI improvements from Release branch to main (#45175) 2024-06-27 04:11:44 -07:00
process-podspecs.sh Update copyright headers from Facebook to Meta 2021-12-30 15:11:21 -08:00
run-ci-javascript-tests.js RN: Fix Open Source Test Scripts 2024-03-29 01:42:24 -07:00
scm-utils.js Enable Flow on misc release scripts (#42736) 2024-01-31 03:36:02 -08:00
sync-css-layout.sh | RN Monorepo | Migrate to package (#36434) 2023-03-17 05:03:25 -07:00
validate-ios-test-env.sh bump Node references from 12/14 to 14/16 (#32980) 2022-01-28 05:07:18 -08:00