Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[metro-babel-register] Ignore babel.config.js files in addition to .babelrc #276

Closed
wants to merge 1 commit into from

Conversation

ide
Copy link
Contributor

@ide ide commented Oct 1, 2018

Summary

This adds support for projects using metro-babel-register with Babel 7's babel.config.js files. The metro-babel-register package is designed to apply a static, hardcoded list of Babel plugins. It intentionally ignores .babelrc files by setting babelrc: false.

Babel 7 added a new configuration file called babel.config.js, with similar but slightly different loading semantics. To disable babel.config.js lookup, there is a new option called configFile instead of babelrc. See https://babeljs.io/docs/en/next/config-files#project-wide-configuration.

Fixes facebook/react-native#21052

Test plan

In a React Native project with babel.config.js and an error about regeneratorRuntime missing when starting the CLI, said error goes away with this metro-babel-register patch.

…abelrc

This adds support for projects using `metro-babel-register` with Babel 7's babel.config.js files. The `metro-babel-register` package is designed to apply a static, hardcoded list of Babel plugins. It intentionally ignores .babelrc files by setting `babelrc: false`.

Babel 7 added a new configuration file called babel.config.js, with similar but slightly different loading semantics. To disable babel.config.js lookup, there is a new option called `configFile` instead of `babelrc`. See https://babeljs.io/docs/en/next/config-files#project-wide-configuration.

Fixes facebook/react-native#21052

Test plan: In a React Native project with babel.config.js and an error about `regeneratorRuntime` missing, said error goes away with this `metro-babel-register` patch.
@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Oct 1, 2018
@codecov-io
Copy link

Codecov Report

Merging #276 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #276   +/-   ##
=======================================
  Coverage   85.75%   85.75%           
=======================================
  Files         144      144           
  Lines        4548     4548           
  Branches      712      712           
=======================================
  Hits         3900     3900           
  Misses        580      580           
  Partials       68       68

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 47f6518...214cb5b. Read the comment docs.

Copy link
Contributor

@rafeca rafeca left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR! We added the configFile: false in other parts of Metro but not in the register module 😅

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rafeca is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

Ragnar-H added a commit to Ragnar-H/metro-babel-register that referenced this pull request Oct 24, 2018
@ide ide deleted the babel-register-config branch October 30, 2018 22:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants