cc @clarkdo, @pi0
Will work on it
After talk to team, this feature may need more discussion and find a proper way to solve the root issue.
core-js
2 and 3 are not compatible and having totally different dir structure, so if a project contains both 2 and 3, user may have files in specific core-js version cannot be found
issue in building or starting phase.
Benefits
Disadvantages
core-js@2/3
, core-js-compat
, but dynamically choosing dependencies is hard in node.js since packages hoisting/cc @pi0
What do we do if we have @babel/preset-env
installed for testing purposes, which includes core-js@3 and we end up with both versions?
yarn why v1.15.2
[1/4] ๐ค Why do we have the module "core-js"...?
[2/4] ๐ Initialising dependency graph...
[3/4] ๐ Finding dependency...
[4/4] ๐ก Calculating file sizes...
=> Found "[email protected]"
info Reasons this module exists
- "@babel#preset-env#core-js-compat" depends on it
- Hoisted from "@babel#preset-env#core-js-compat#core-js"
info Number of shared dependencies: 0
=> Found "babel-runtime#[email protected]"
info This module exists because "vue-jest#babel-plugin-transform-es2015-modules-commonjs#babel-runtime" depends on it.
info Number of shared dependencies: 0
=> Found "@nuxt/babel-preset-app#[email protected]"
info This module exists because "nuxt#@nuxt#webpack#@nuxt#babel-preset-app" depends on it.
info Number of shared dependencies: 0
โจ Done in 1.47s.
@posva True :( We are in the middle of a breaking change by babel. Some 3rd party packages still depending on corejs@2
and some on corejs@3
and can't have both on a same project. So decided to make @3
opt-in and suggesting users that facing the problem to manually install one version in their package.json
That has to be hard for you to handle, I'm sorry
For the moment installing core-js@3 seems to show the same problem. Maybe I need to downgrade nuxt or @babel/preset-env until @3 is an optin?
@posva See _core-js@3_ section of release notes
Thanks! It's weird, because I removed core-js from the package.json, removed node_modules and yarn.lock, reinstalled, and things work again
@posva It's probably because package hoisting due to yarn.lock.
The new generated yarn.lock may be more flat than old one, so the core-js in node_modules is expected version after re-install.
It indeed changed to 2 different versions of core-js instead of 3 but there was still core-js@3 and core-js@2. The one hoisted is the v2 now ๐
yarn why v1.15.2
[1/4] ๐ค Why do we have the module "core-js"...?
[2/4] ๐ Initialising dependency graph...
[3/4] ๐ Finding dependency...
[4/4] ๐ก Calculating file sizes...
=> Found "[email protected]"
info Has been hoisted to "core-js"
info Reasons this module exists
- Hoisted from "vue-jest#babel-plugin-transform-es2015-modules-commonjs#babel-runtime#core-js"
- Hoisted from "nuxt#@nuxt#webpack#@nuxt#babel-preset-app#core-js"
info Number of shared dependencies: 0
=> Found "core-js-compat#[email protected]"
info This module exists because "@babel#preset-env#core-js-compat" depends on it.
info Number of shared dependencies: 0
Has been release in v2.6.0
Most helpful comment
After talk to team, this feature may need more discussion and find a proper way to solve the root issue.
core-js
2 and 3 are not compatible and having totally different dir structure, so if a project contains both 2 and 3, user may havefiles in specific core-js version cannot be found
issue in building or starting phase.Benefits
Disadvantages
core-js@2/3
,core-js-compat
, but dynamically choosing dependencies is hard in node.js since packages hoisting