Skip to content
This repository has been archived by the owner on Jun 1, 2023. It is now read-only.

core-js@3 の利用が期待した通りになっていない可能性があります #5301

Closed
ghost opened this issue Aug 18, 2020 · 5 comments · Fixed by #5350
Closed

core-js@3 の利用が期待した通りになっていない可能性があります #5301

ghost opened this issue Aug 18, 2020 · 5 comments · Fixed by #5350
Labels
help-wanted 特に助けを必要としているもの improvement 改善や新機能の要望

Comments

@ghost
Copy link

ghost commented Aug 18, 2020

改善詳細 / Details of Improvement

  • core-js@3 の利用が期待した通りになっていない可能性があります
  • メンテナンス等で yarn.lock の再生成が行われると利用するパッケージの内容が変わります

スクリーンショット / Screenshot

  • 現在の状態は以下の通りです
    (本来ならば nuxt.jsbabel の最新バージョンにおける自動判定で core-js@3 が利用されはずですが...)
tokyo-citizen@macos ~ % node --version
v12.18.3
tokyo-citizen@macos ~ % yarn --version
1.22.4
tokyo-citizen@macos ~ % git clone git://github.com/tokyo-metropolitan-gov/covid19.git covid19
Cloning into 'covid19'...
remote: Enumerating objects: 613188, done.
remote: Total 613188 (delta 0), reused 0 (delta 0), pack-reused 613188
Receiving objects: 100% (613188/613188), 1.10 GiB | 10.76 MiB/s, done.
Resolving deltas: 100% (302225/302225), done.
tokyo-citizen@macos ~ % cd covid19
tokyo-citizen@macos covid19 % yarn install --frozen-lockfile
yarn install v1.22.4
[1/5] 🔍  Validating package.json...
[2/5] 🔍  Resolving packages...
[3/5] 🚚  Fetching packages...
[4/5] 🔗  Linking dependencies...
warning "@nuxtjs/eslint-config > eslint-plugin-vue@6.2.2" has incorrect peer dependency "eslint@^5.0.0 || ^6.0.0".
warning "@nuxtjs/stylelint-module > stylelint-webpack-plugin@2.1.0" has unmet peer dependency "webpack@^4.0.0 || ^5.0.0".
warning "@nuxtjs/vuetify > sass-loader@8.0.2" has unmet peer dependency "webpack@^4.36.0 || ^5.0.0".
warning "@nuxtjs/vuetify > vuetify-loader@1.5.0" has unmet peer dependency "webpack@^4.0.0".
warning "nuxt-purgecss > purgecss-webpack-plugin@2.3.0" has unmet peer dependency "webpack@*".
warning " > vue-axe@2.4.0" has incorrect peer dependency "axe-core@3.5.3".
warning " > vue-jest@4.0.0-beta.5" has incorrect peer dependency "jest@^25.x".
warning "vue-jest > ts-jest@25.5.1" has incorrect peer dependency "jest@>=25 <26".
[5/5] 🔨  Building fresh packages...
✨  Done in 18.71s.
tokyo-citizen@macos covid19 % yarn list --pattern "core-js|corejs"
yarn list v1.22.4
├─ @babel/runtime-corejs3@7.10.4
├─ core-js-compat@3.6.5
├─ core-js-pure@3.6.5
└─ core-js@2.6.11
✨  Done in 0.96s.
  • yarn.lock を再生成すると @babel/runtime-corejs3core-js-pure が消えます
tokyo-citizen@macos covid19 % rm yarn.lock
tokyo-citizen@macos covid19 % rm -rf node_modules
tokyo-citizen@macos covid19 % yarn install
yarn install v1.22.4
info No lockfile found.
[1/5] 🔍  Validating package.json...
[2/5] 🔍  Resolving packages...
warning nuxt > @nuxt/webpack > @nuxt/babel-preset-app > core-js@2.6.11: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
warning nuxt > @nuxt/webpack > webpack > watchpack > watchpack-chokidar2 > chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
warning nuxt > @nuxt/webpack > webpack > watchpack > watchpack-chokidar2 > chokidar > fsevents@1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
warning nuxt > @nuxt/webpack > webpack > micromatch > snapdragon > source-map-resolve > resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
warning nuxt > @nuxt/webpack > webpack > micromatch > snapdragon > source-map-resolve > urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
warning jest > @jest/core > jest-config > jest-environment-jsdom > jsdom > request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
warning jest > @jest/core > jest-config > jest-environment-jsdom > jsdom > request-promise-native@1.0.9: request-promise-native has been deprecated because it extends the now deprecated request package, see https://github.com/request/request/issues/3142
warning jest > @jest/core > jest-config > jest-environment-jsdom > jsdom > request > har-validator@5.1.5: this library is no longer supported
warning vue-jest > extract-from-css > css > urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
[3/5] 🚚  Fetching packages...
[4/5] 🔗  Linking dependencies...
warning "@nuxtjs/eslint-config > eslint-plugin-vue@6.2.2" has incorrect peer dependency "eslint@^5.0.0 || ^6.0.0".
warning "@nuxtjs/stylelint-module > stylelint-webpack-plugin@2.1.0" has unmet peer dependency "webpack@^4.0.0 || ^5.0.0".
warning "@nuxtjs/vuetify > vuetify-loader@1.6.0" has unmet peer dependency "webpack@^4.0.0".
warning "@nuxtjs/vuetify > sass-loader@8.0.2" has unmet peer dependency "webpack@^4.36.0 || ^5.0.0".
warning "nuxt-purgecss > purgecss-webpack-plugin@2.3.0" has unmet peer dependency "webpack@*".
warning " > vue-axe@2.4.0" has incorrect peer dependency "axe-core@3.5.3".
warning " > vue-jest@4.0.0-beta.5" has incorrect peer dependency "jest@^25.x".
warning "vue-jest > ts-jest@25.5.1" has incorrect peer dependency "jest@>=25 <26".
[5/5] 🔨  Building fresh packages...
success Saved lockfile.
✨  Done in 36.19s.
tokyo-citizen@macos covid19 % yarn list --pattern "core-js|corejs"
yarn list v1.22.4
├─ core-js-compat@3.6.5
└─ core-js@2.6.11
✨  Done in 0.92s.
tokyo-citizen@macos covid19 % yarn add -D core-js@3.6.5 @babel/runtime-corejs3@7.11.2
yarn add v1.22.4
[1/5] 🔍  Validating package.json...
[2/5] 🔍  Resolving packages...
[3/5] 🚚  Fetching packages...
[4/5] 🔗  Linking dependencies...
warning "@nuxtjs/eslint-config > eslint-plugin-vue@6.2.2" has incorrect peer dependency "eslint@^5.0.0 || ^6.0.0".
warning "@nuxtjs/stylelint-module > stylelint-webpack-plugin@2.1.0" has unmet peer dependency "webpack@^4.0.0 || ^5.0.0".
warning "@nuxtjs/vuetify > sass-loader@8.0.2" has unmet peer dependency "webpack@^4.36.0 || ^5.0.0".
warning "@nuxtjs/vuetify > vuetify-loader@1.6.0" has unmet peer dependency "webpack@^4.0.0".
warning "nuxt-purgecss > purgecss-webpack-plugin@2.3.0" has unmet peer dependency "webpack@*".
warning " > vue-axe@2.4.0" has incorrect peer dependency "axe-core@3.5.3".
warning " > vue-jest@4.0.0-beta.5" has incorrect peer dependency "jest@^25.x".
warning "vue-jest > ts-jest@25.5.1" has incorrect peer dependency "jest@>=25 <26".
[5/5] 🔨  Building fresh packages...
success Saved lockfile.
success Saved 3 new dependencies.
info Direct dependencies
├─ @babel/runtime-corejs3@7.11.2
└─ core-js@3.6.5
info All dependencies
├─ @babel/runtime-corejs3@7.11.2
├─ core-js-pure@3.6.5
└─ core-js@3.6.5
✨  Done in 9.26s.
  • 念のためにさらに yarn.lock を再生成した時の挙動を確認します
tokyo-citizen@macos covid19 % rm yarn.lock
tokyo-citizen@macos covid19 % rm -rf node_modules
tokyo-citizen@macos covid19 % yarn install
yarn install v1.22.4
info No lockfile found.
[1/5] 🔍  Validating package.json...
[2/5] 🔍  Resolving packages...
warning nuxt > @nuxt/webpack > @nuxt/babel-preset-app > core-js@2.6.11: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
warning nuxt > @nuxt/webpack > webpack > watchpack > watchpack-chokidar2 > chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
warning nuxt > @nuxt/webpack > webpack > watchpack > watchpack-chokidar2 > chokidar > fsevents@1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
warning nuxt > @nuxt/webpack > webpack > micromatch > snapdragon > source-map-resolve > resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
warning nuxt > @nuxt/webpack > webpack > micromatch > snapdragon > source-map-resolve > urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
warning jest > @jest/core > jest-config > jest-environment-jsdom > jsdom > request-promise-native@1.0.9: request-promise-native has been deprecated because it extends the now deprecated request package, see https://github.com/request/request/issues/3142
warning jest > @jest/core > jest-config > jest-environment-jsdom > jsdom > request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
warning jest > @jest/core > jest-config > jest-environment-jsdom > jsdom > request > har-validator@5.1.5: this library is no longer supported
warning vue-jest > extract-from-css > css > urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
[3/5] 🚚  Fetching packages...
[4/5] 🔗  Linking dependencies...
warning "@nuxtjs/eslint-config > eslint-plugin-vue@6.2.2" has incorrect peer dependency "eslint@^5.0.0 || ^6.0.0".
warning "@nuxtjs/stylelint-module > stylelint-webpack-plugin@2.1.0" has unmet peer dependency "webpack@^4.0.0 || ^5.0.0".
warning "@nuxtjs/vuetify > vuetify-loader@1.6.0" has unmet peer dependency "webpack@^4.0.0".
warning "@nuxtjs/vuetify > sass-loader@8.0.2" has unmet peer dependency "webpack@^4.36.0 || ^5.0.0".
warning "nuxt-purgecss > purgecss-webpack-plugin@2.3.0" has unmet peer dependency "webpack@*".
warning " > vue-axe@2.4.0" has incorrect peer dependency "axe-core@3.5.3".
warning " > vue-jest@4.0.0-beta.5" has incorrect peer dependency "jest@^25.x".
warning "vue-jest > ts-jest@25.5.1" has incorrect peer dependency "jest@>=25 <26".
[5/5] 🔨  Building fresh packages...
success Saved lockfile.
✨  Done in 32.73s.
tokyo-citizen@macos covid19 % yarn list --pattern "core-js|corejs"
yarn list v1.22.4
├─ @babel/runtime-corejs3@7.11.2
├─ @nuxt/babel-preset-app@2.14.1
│  └─ core-js@2.6.11
├─ core-js-compat@3.6.5
├─ core-js-pure@3.6.5
└─ core-js@3.6.5
✨  Done in 0.91s.
  • 参考として更新後の yarn.lock を用いて yarn install した場合の挙動です
tokyo-citizen@macos covid19 % rm -rf node_modules
tokyo-citizen@macos covid19 % yarn install --frozen-lockfile
yarn install v1.22.4
[1/5] 🔍  Validating package.json...
[2/5] 🔍  Resolving packages...
[3/5] 🚚  Fetching packages...
[4/5] 🔗  Linking dependencies...
warning "@nuxtjs/eslint-config > eslint-plugin-vue@6.2.2" has incorrect peer dependency "eslint@^5.0.0 || ^6.0.0".
warning "@nuxtjs/stylelint-module > stylelint-webpack-plugin@2.1.0" has unmet peer dependency "webpack@^4.0.0 || ^5.0.0".
warning "@nuxtjs/vuetify > sass-loader@8.0.2" has unmet peer dependency "webpack@^4.36.0 || ^5.0.0".
warning "@nuxtjs/vuetify > vuetify-loader@1.6.0" has unmet peer dependency "webpack@^4.0.0".
warning "nuxt-purgecss > purgecss-webpack-plugin@2.3.0" has unmet peer dependency "webpack@*".
warning " > vue-axe@2.4.0" has incorrect peer dependency "axe-core@3.5.3".
warning " > vue-jest@4.0.0-beta.5" has incorrect peer dependency "jest@^25.x".
warning "vue-jest > ts-jest@25.5.1" has incorrect peer dependency "jest@>=25 <26".
[5/5] 🔨  Building fresh packages...
✨  Done in 17.57s.
tokyo-citizen@macos covid19 % yarn list --pattern "core-js|corejs"
yarn list v1.22.4
├─ @babel/runtime-corejs3@7.11.2
├─ @nuxt/babel-preset-app@2.14.1
│  └─ core-js@2.6.11
├─ core-js-compat@3.6.5
├─ core-js-pure@3.6.5
└─ core-js@3.6.5
✨  Done in 0.90s.

期待する見せ方・挙動 / Expected behavior

  • @nuxt/babel-preset-app のドキュメントでは core-js@3 を利用する場合には明示的に yarn add -D することが推奨されているようです
  • 以下のように明示的に core-js@3 を利用するように package.json を変更するのが良いと思います
    yarn add -D core-js@3.6.5 @babel/runtime-corejs3@7.11.2
    (バージョンを pin 留めしているのは現在の Renovate の設定が pin 留めとなっているためです)

動作環境・ブラウザ / Environment

  • 開発環境
@ghost ghost added the improvement 改善や新機能の要望 label Aug 18, 2020
@ghost ghost changed the title core-js@3 の利用が現状の yarn.lock の状態のみに依存している core-js@3 の利用が期待した通りになっていない可能性があります Aug 18, 2020
@kaizumaki kaizumaki added the help-wanted 特に助けを必要としているもの label Aug 18, 2020
@mcdmaster
Copy link
Contributor

mcdmaster commented Aug 21, 2020

論点が散逸するといけないので、ここでコメントしますね。

yarn.lock の中身は、実は私が #4918 #5061 を企図した時点で既に気になっていました。
というのも、個人環境では早いうちから core-js@3 を試していたときにその振舞いに気づいていたためです。
また、善後策として package.json ファイルに "resolutions" というブロックを書けば core-js@3chokidar@3 などの依存関係ワークアラウンドを実施できることも見つけていました。

とはいえ、私自身がまだ "resolutions" の機能もしくはそもそもそれが作られた経緯を飲み込めていなかったことと、"resolutions" じたいがいまだ実験的ステータスという yarn公式コメントに基づき、コアメンバーの皆さんからのお勧めもあって "resolutions" を取り下げました。

今、依存関係解決のために巨大な yarn.lock ファイルの編集を試みる話をしているという認識です。
とはいえ、当初求めていた優れた保守性という意味では、yarn.lock ファイルを都度イジるのはかならずしも優れた保守性を実現しないのでは、という懸念を持っています。
であれば、"resolutions" の使用の再検討の道もあるのではないかと、今ここでコッソリ(どこがやねん)と提案しておきます

@goki90210
Copy link
Contributor

今、依存関係解決のために巨大な yarn.lock ファイルの編集を試みる話をしているという認識です。
とはいえ、当初求めていた優れた保守性という意味では、yarn.lock ファイルを都度イジるのはかならずしも優れた保守性を実現しないのでは、という懸念を持っています。

この運用にしてしまうとyarn.lockの存在自体(もしくはyarn.lockをGitで管理すること)の否定になりますね。

@ghost
Copy link
Author

ghost commented Aug 23, 2020

@goki90210 さん
おっしゃる通りで、このIssueでは core-js@3 の中途半端な状態に絞って、package.json
どうするかという話を扱っております。😅

@kaizumaki
Copy link
Collaborator

yarn.lockをリフレッシュしたPR #5350 を出しました。RenovateのLock file maintenance #5349 がNetlifyでコケるため、緊急の措置です。
そういうわけで、こちらのissueも検討したいのですが、いかがでしょう?
ちなみに #5350 のプレビューはIE11で正常に表示できているようです。

@kaizumaki
Copy link
Collaborator

#5302@tokyo-citizen さんのコメント のとおり、#5350 のPRでこちらのissueも解決しようと思います。
yarn add -D core-js@3.6.5 @babel/runtime-corejs3@7.11.2 をするとよいでしょうか?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
help-wanted 特に助けを必要としているもの improvement 改善や新機能の要望
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants