Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
Community
OrganizationEventAdvent CalendarQiitadon (β)
Service
Qiita JobsQiita ZineQiita Blog
14
Help us understand the problem. What is going on with this article?

More than 1 year has passed since last update.

@oreo3@github

【npm】エラー解決:We noticed you're using the useBuiltIns option without declaring a core-js version. Currently, we assume version 2.x when no version is

npm update して gulp のタスクを走らせたところ、以下のメッセージが。
超意訳「core-js のバージョン指定なしで useBuiltIns オプションを使ってるよ(略)」

$ npx gulp watch

Requiring external module @babel/register

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

gatsbyjs の Issues にあった解決法で解決できた。

core-js@2 と core-js@3 どっちを指定すべきかわからなかったので、@babel/preset-env (7.3.4 → 7.4.2) と @babel/register (7.0.0 → 7.4.0) が 依存している core-js が共に v3 であることを確認。.babelrc に下記の通りバージョンを追加した。以上。

// 変更前
{
  "presets": [
    [
      "@babel/preset-env",
      {
        "useBuiltIns": "usage",
        "corejs": 3 // ← バージョンを追加
      }
    ]
  ]
}

なお、警告文にある通り、指定なしだとバージョン2が指定されるようになっており、放置したとしても当面は問題ないみたい。

14
Help us understand the problem. What is going on with this article?
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
14
Help us understand the problem. What is going on with this article?