13
8

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

core-js/modules/es6(以下略)が見つかりません。の場合

Last updated at Posted at 2019-12-10

少し前に調べた事をメモっておく。
nodeか、vue-cliのバージョンとかを上げた時に、babelが古いと言われるので7に上げて…

$ npm run serve
$ vue-cli-service serve

serveすると…

These dependencies were not found:

core-js/modules/es6.array.iterator
core-js/modules/es6.function.name
core-js/modules/es6.number.constructor
core-js/modules/es6.object.assign
core-js/modules/es6.object.to-string
core-js/modules/es6.promise
core-js/modules/es6.regexp.match
core-js/modules/es6.regexp.replace
core-js/modules/es6.regexp.split
core-js/modules/es6.regexp.to-string
core-js/modules/es6.string.includes
core-js/modules/es6.string.iterator
core-js/modules/es6.typed.uint8-array
core-js/modules/es7.array.includes
core-js/modules/es7.promise.finally
core-js/modules/web.dom.iterable

が出ました。何かなと思ったら…
https://babeljs.io/docs/en/babel-preset-env#usebuiltins

Since @babel/polyfill was deprecated in 7.4.0, we recommend directly adding core-js and setting the version via the corejs option.
@ babel / polyfillは7.4.0で非推奨になったため、core-jsを直接追加し、corejsオプションでバージョンを設定することをお勧めします。

だそうです。なので、とりあえず

$ npm install --save core-js

これだけでは動かないので、babel.config.jsを書き換える必要があるみたいです。

babel.config.js
module.exports = {
  presets: [
    '@vue/app'
  ]
}

@babel/polyfillをimport/requireする方法だそうです。

babel.config.js
module.exports = {
  presets: [
    [
      "@vue/app", { useBuiltIns: "entry" } //entry または false
    ]
  ]
}

babel-preset-envのなにかを読み込める設定らしいです。

参考にしたページ
https://github.com/vuejs/vue-cli/issues/3678
https://aloerina01.github.io/blog/2018-11-29-1

13
8
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
13
8

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?