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

Getting warning - `useBuiltIns` option without declaring a core-js version even though there is (core-js@3.1.3) #10049

Closed
slavkobojanic opened this issue May 31, 2019 · 3 comments

Comments

Projects
None yet
4 participants
@slavkobojanic
Copy link

commented May 31, 2019

Bug Report

Current Behavior
It seems as if @babel/preset-env@7.4.5 is giving me a bit of a hard time after upgrading from core-js@2.x.x to core-js@3.1.3, the error it's spitting out says that .babelrc needs to have a core-js version specified if i'd like to use useBuiltIns. I've definitely tried to install core-js@3 as both a normal dependency and as a devDependency with no success, as well as that i'd tried to install core-js@3.1.3 as a global node_module which still had changed nothing.
This issue only occurs the first time I do a npm install then run my webpack build, and then doesn't occur again on subsequent webpack builds which I found odd.

Input Code

  • REPL or Repo link if applicable:
Not applicable, no input

Expected behavior/code
There shouldn't be any errors thrown by webpack about a missing core-js dependency when it is clearly installed.

Babel Configuration (.babelrc, package.json, cli command)

{
  "presets": [
    [
      "@babel/preset-env",
      {
        "targets": {
          "browsers": [
            "last 2 versions",
            "ie >= 11"
          ],
          "corejs": "3.1.3",
          "useBuiltIns": "usage"
        }
      }
    ],
    "@babel/preset-react"
  ],
  "plugins": [
    "@babel/plugin-proposal-class-properties"
  ],
  "env": {
    "test-pipeline": {
      "plugins": [
        "@babel/plugin-transform-runtime",
        "istanbul"
      ]
    },
    "test": {
      "plugins": [
        "@babel/plugin-transform-runtime",
        "istanbul"
      ]
    },
    "development": {
      "plugins": [
        "@babel/plugin-transform-runtime",
        "react-hot-loader/babel"
      ]
    }
  }
}

Environment

  • Babel version(s): 7.4.5
  • Node/npm version: 11.15.0
  • OS: Ubuntu 18.04 LTS
  • Monorepo: No
  • How you are using Babel: babel-loader

Possible Solution
No suggestions here

Additional context/Screenshots
Doesn't require screenshots, but can be added for context :)

@babel-bot

This comment has been minimized.

Copy link
Collaborator

commented May 31, 2019

Hey @slavkobojanic! We really appreciate you taking the time to report an issue. The collaborators
on this project attempt to help as many people as possible, but we're a limited number of volunteers,
so it's possible this won't be addressed swiftly.

If you need any help, or just have general Babel or JavaScript questions, we have a vibrant Slack
community
that typically always has someone willing to help. You can sign-up here
for an invite.

@hegelstad

This comment has been minimized.

Copy link

commented Jun 12, 2019

Don't put corejs and useBuiltIns properties inside of target.

@nicolo-ribaudo

This comment has been minimized.

Copy link
Member

commented Jun 12, 2019

Exactly, it should be like this:

{
  "presets": [
    [
      "@babel/preset-env",
      {
        "targets": {
          "browsers": [
            "last 2 versions",
            "ie >= 11"
          ],
        },
        "corejs": "3.1.3",
        "useBuiltIns": "usage"
      }
    ],
    "@babel/preset-react"
  ],
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.