question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Fix babel useBuiltIns core-js warning

See original GitHub issue
  • I confirm that this is an issue rather than a question.

Bug report

When running ‘vanilla’ build see the following warning in the console

WARNING: We noticed you're using the `useBuiltIns` option without declaring a core-js version. Currently, we assume version 2.x when no version is passed. Since this default version will likely change in future versions of Babel, we recommend explicitly setting the core-js version you are using via the `corejs` option.


You should also be sure that the version you pass to the `corejs` option matches the version specified in your `package.json`'s `dependencies` section. If it doesn't, you need to run one of the following commands:

  npm install --save core-js@2    npm install --save core-js@3
  yarn add core-js@2              yarn add core-js@3

Version

@vuepress/core@1.0.0-alpha.44

Steps to reproduce

$ mkdir test; cd test; npm init # accept defaults $ npm install vuepress@next $ echo ‘# Hello VuePress’ > README.md $ ./node_modules/.bin/vuepress build

What is expected?

no warnings about useBuiltIns

What is actually happening?

scary warning 😉

actually, some additional information on how I stumbled across this. In my case adding nuxt@2.5.0 (used core-js 3) caused the “vupress build” to fail. Whereas adding nuxt@2.5.1 (uses core-js 2) makes the vuepress build error and warning go away. Related to https://github.com/nuxt/nuxt.js/issues/5313

Other relevant information

  • Your OS: Windows 10
  • Node.js version: 8.15.1
  • Browser version: n/a
  • Is this a global or local install? local
  • Which package manager did you use for the install? npm 6.4.1
  • Does this issue occur when all plugins are disabled? unsure, only using defaults

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:24
  • Comments:12

github_iconTop GitHub Comments

88reactions
sidwaseemcommented, Mar 31, 2019

Adding "corejs": "3.0.0" in the .babelrc file turned off the warnings.

"presets": [
        [
            "@babel/preset-env",
            {
                "useBuiltIns": "usage", // "usage" | "entry" | false, defaults to false.
                "corejs": "3.0.0",
                "targets": {
                    "esmodules": true,
                    "ie": "11"
                }
            }
        ]
    ],
4reactions
ghenrycommented, Mar 22, 2019

I see this on the latest vue cli and vue js SPA build too.

Read more comments on GitHub >

github_iconTop Results From Across the Web

What does this error mean? With `useBuiltIns` option, required ...
Getting the same issue. Resolved it by installing core-js as a top level dependency and then adding it as an option to .babelrc...
Read more >
WARNING: We noticed you're using the `useBuiltIns` option ...
WARNING (@babel/preset-env): We noticed you're using the `useBuiltIns` option without declaring a core-js version.
Read more >
babel/preset-env
This behavior is deprecated because it isn't possible to use @babel/polyfill with different core-js versions. useBuiltIns: 'usage'. Adds specific imports for ...
Read more >
babel-loader - webpack
ProvidePlugin({ 'Promise': 'bluebird' }), // ... The following approach will not work either: require('@babel/runtime/core-js ...
Read more >
What you don't know about BabelJS preset-env - PerimeterX
The preset-env useBuiltins flag determines if babel should always add corejs polyfills, add them once per file or per usage of a particular ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found