fix how @babel/register is used and update it (#46987)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46987

X-link: https://github.com/facebook/metro/pull/1371

Update `babel/register` to latest version, fixing the bug that were preventing us from updating it previously.

Changelog: [Internal]

Reviewed By: huntie

Differential Revision: D64245277

fbshipit-source-id: f3d07b06a11fbe3a0ed28e22f5b687541782dda9
This commit is contained in:
Vitali Zaidman 2024-10-14 06:30:59 -07:00 committed by Facebook GitHub Bot
parent 4dd47eeb9e
commit e08c7eb22a

View File

@ -30,7 +30,12 @@ function registerForMonorepo() {
return;
}
require('metro-babel-register')([PACKAGES_DIR]);
if (process.env.FBSOURCE_ENV === '1') {
// $FlowExpectedError[cannot-resolve-module] - Won't resolve in OSS
require('@fb-tools/babel-register');
} else {
require('metro-babel-register')([PACKAGES_DIR]);
}
isRegisteredForMonorepo = true;
}