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

fix(babel-preset-gatsby): Add corejs to config #12781

Merged

Conversation

erikdstock
Copy link
Contributor

@erikdstock erikdstock commented Mar 23, 2019

Description

Gatsby started warning in development mode about a missing but assumed corejs config that was subject to change. The issue linked below tracks down the source of the problem and this fix quiets it down. Thanks!

Related Issues

Fixes #12744

@erikdstock erikdstock changed the title Add corejs to babel-preset-gatsby's config fix(babel-preset-gatsby) Add corejs to config Mar 23, 2019
@erikdstock
Copy link
Contributor Author

erikdstock commented Mar 23, 2019

Hmmm. This is a bummer.

Several failed builds about putting corejs as a top-level option, but it's in the babel-preset-env source as of 3 days ago. It looks like this would be a version bump from 7.0.0 - 7.4.1 - happy to give it a go.

Summary of all failing tests
 FAIL  packages/gatsby/cache-dir/__tests__/minimal-config.js
  ● Builds cache-dir with minimal config

    expect(received).toEqual(expected)

    Difference:

    - Expected
    + Received

    + Error: [BABEL] /home/circleci/project/packages/gatsby/cache-dir/api-runner-browser-plugins.js: Invalid Option: corejs is not a valid top-level option.
    +         Maybe you meant to use 'targets'? (While processing: "/home/circleci/project/node_modules/@babel/preset-env/lib/index.js")
    +     at validateTopLevelOptions (/home/circleci/project/node_modules/@babel/preset-env/lib/normalize-options.js:49:13)

@erikdstock erikdstock changed the title fix(babel-preset-gatsby) Add corejs to config fix(babel-preset-gatsby): Add corejs to config Mar 23, 2019
@moonmeister moonmeister added type: bug An issue or pull request relating to a bug in Gatsby status: awaiting reviewer response A pull request that is currently awaiting a reviewer's response labels Mar 23, 2019
@KyleAMathews
Copy link
Contributor

From my read of https://babeljs.io/blog/2019/03/19/7.4.0#migration-from-core-js-2 — we need to use core-js@3 not 2 because we're using @babel/preset-env.

@erikdstock
Copy link
Contributor Author

Thanks @KyleAMathews - I tried to do it the fast way with a find/replace on package.jsons and although tests passed it's not running in my test app. The link you mentioned above actually says that core-js@2 will remain the default since 3 has breaking changes, which tracks with the warning message on build- saying that babel-preset-env is assuming 2, but that will change, so best to add the property to the config (this PR).

How would you feel about merging to appease babel for now and making followup issues to upgrade core-js in the gatsby and gastby-cli packages?

@KyleAMathews
Copy link
Contributor

Ok, the blog post is a bit confusing then. Yeah, then going with 2 for now makes sense and we can upgrade when we release Gatsby v3.

@KyleAMathews KyleAMathews merged commit 4b49da1 into gatsbyjs:master Mar 23, 2019
@gatsbot
Copy link

gatsbot bot commented Mar 23, 2019

Holy buckets, @erikdstock — we just merged your PR to Gatsby! 💪💜

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. (Currently we’ve got a couple t-shirts available, plus some socks that are really razzing our berries right now.)
  2. We just invited you to join the Gatsby organization on GitHub. This will add you to our team of maintainers. Accept the invite by visiting https://github.com/orgs/gatsbyjs/invitation. By joining the team, you’ll be able to label issues, review pull requests, and merge approved pull requests.

If there’s anything we can do to help, 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
status: awaiting reviewer response A pull request that is currently awaiting a reviewer's response type: bug An issue or pull request relating to a bug in Gatsby
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error: Cannot find module 'core-js/modules/es6.object.assign'
3 participants