Skip to content

Commit

Permalink
Don't unnecessarily double-register Babel (#963)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #963

D5380795 (6 years ago) introduced a workaround for a Babel re-entrancy bug reported by React Native users in facebook/react-native#14530.

Since babel/babel#7588 (Babel 7.0), this bug was fixed upstream - it's now effectively a no-op to register Babel twice. The old workaround gets in the way of cleanly "unregistering" Babel because it pushes two hooks onto the `pirates` stack, and possibly has a slight perf impact.

Changelog: Internal

Reviewed By: huntie

Differential Revision: D44627126

fbshipit-source-id: b7971af85c5d9ad9e71b53409170c7040f07217d
  • Loading branch information
robhogan authored and facebook-github-bot committed Apr 4, 2023
1 parent ac5d90a commit 8887836
Showing 1 changed file with 0 additions and 10 deletions.
10 changes: 0 additions & 10 deletions packages/metro-babel-register/src/babel-register.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,6 @@ const path = require('path');
let _only = [];

function register(onlyList) {
// This prevents `babel-register` from transforming the code of the
// plugins/presets that we are require-ing themselves before setting up the
// actual config.
require('@babel/register')({
babelrc: false,
configFile: false,
// make sure we don't transpile any npm packages
ignore: [/\/node_modules\//],
only: [],
});
require('@babel/register')({
...config(onlyList),
extensions: [
Expand Down

0 comments on commit 8887836

Please sign in to comment.