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

Bugfix to allow for configured babel presets such as the env preset. #668

Merged
merged 3 commits into from
Feb 9, 2017

Conversation

4rkanoid
Copy link
Contributor

@4rkanoid 4rkanoid commented Feb 9, 2017

I tried using the babel-preset-env in my gatsby project and the babel-config module threw this exception:

Invariant Violation:
  You are trying to use a Babel plugin which Gatsby cannot find. You
  can install it using "npm install --save babel-preset-env,[object Object]".

  You can use any of the Gatsby provided plugins without installing them:
    - babel-plugin-add-module-exports
    - babel-plugin-transform-object-assign
    - babel-preset-es2015
    - babel-preset-react
    - babel-preset-stage-0

I figured it must be due to how the .babelrc is parsed and saw that there is no logic for extracting the preset name when the preset is in array form (which is done with plugins).

This pr has a simple fix that just replicate the logic for plugin names into doing the same thing for presets.
Cheers!

@KyleAMathews
Copy link
Contributor

Oh nice! Thanks for the bug fix! Will push out in a release in a sec.

@KyleAMathews KyleAMathews merged commit 8f07082 into gatsbyjs:master Feb 9, 2017
@4rkanoid
Copy link
Contributor Author

4rkanoid commented Feb 9, 2017

Sweet 👍

@4rkanoid 4rkanoid deleted the bugfix-babel-preset-env branch February 9, 2017 21:45
@jlengstorf
Copy link
Contributor

Hiya @4rkanoid! 👋

This is definitely late, but on behalf of the entire Gatsby community, I wanted to say thank you for being here.

Gatsby is built by awesome people like you. Let us say “thanks” in two ways:

  1. We’d like to send you some Gatsby swag. As a token of our appreciation, you can go to the Gatsby Swag Store and log in with your GitHub account to get a coupon code good for one free piece of swag. (We’ve got t-shirts and hats, plus some socks that are really razzing our berries right now.)
  2. If you’re not already part of it, we just invited you to join the Gatsby organization on GitHub. This will add you to our team of maintainers. You’ll receive an email shortly asking you to confirm. By joining the team, you’ll be able to label issues, review pull requests, and merge approved pull requests.

If you have questions, please don’t hesitate to reach out to us: tweet at @gatsbyjs and we’ll come a-runnin’.

Thanks again! 💪💜

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants