Do you want to request a feature or report a bug?
bug
What is the current behavior?yarn install respects a nohoist key on the root package.json that allows you to deal with modules that would create problems when hoisted. In my case core-js v2 ends up in the root and core-js v3 ends up in a package node_modules.
When you run yarn install --production, the package specific node_modules core-js is removed.
Subsequently v3 specific imports fail.
core-js is normally a transitive dependency, so this behavior leads me to believe that there is a bug here.
If the current behavior is a bug, please provide the steps to reproduce.
I have included an output of yarn why core-js output
=> Found "core-js@2.6.9"
info Has been hoisted to "core-js"
info Reasons this module exists
- "workspace-aggregator-7c9f71ce-7c2c-4466-80af-90cc77b8cd92" depends on it
- Hoisted from "_project_#@lingui#cli#babel-runtime#core-js"
- Hoisted from "_project_#social#react-native#metro-babel-register#core-js"
- Hoisted from "_project_#social#react-native#fbjs#core-js"
- Hoisted from "_project_#social#react-native#fbjs-scripts#core-js"
- Hoisted from "_project_#server#react-native-web#fbjs#core-js"
- Hoisted from "_project_#jest-config#babel-core#babel-register#core-js"
- Hoisted from "_project_#common-lib#react-dropzone#attr-accept#core-js"
- Hoisted from "_project_#server#react-ace#@babel#polyfill#core-js"
- Hoisted from "_project_#mobile#@react-native-community#cli#metro#fbjs#core-js"
- Hoisted from "_project_#mobile-web#@lingui#loader#@lingui#cli#opencollective#babel-polyfill#core-js"
info Disk size without dependencies: "7.68MB"
info Disk size with unique dependencies: "7.68MB"
info Disk size with transitive dependencies: "7.68MB"
info Number of shared dependencies: 0
=> Found "server#core-js@3.1.4"
info This module exists because "_project_#server" depends on it.
info Disk size without dependencies: "6.69MB"
info Disk size with unique dependencies: "6.69MB"
info Disk size with transitive dependencies: "6.69MB"
info Number of shared dependencies: 0
=> Found "prettier-eslint#core-js@3.1.4"
info This module exists because "_project_#prettier-eslint" depends on it.
info Disk size without dependencies: "6.69MB"
info Disk size with unique dependencies: "6.69MB"
info Disk size with transitive dependencies: "6.69MB"
info Number of shared dependencies: 0
=> Found "prettier-eslint-cli#core-js@3.1.4"
info This module exists because "_project_#prettier-eslint-cli" depends on it.
info Disk size without dependencies: "6.69MB"
info Disk size with unique dependencies: "6.69MB"
info Disk size with transitive dependencies: "6.69MB"
info Number of shared dependencies: 0
=> Found "react-app-polyfill#core-js@3.0.1"
info This module exists because "_project_#mobile-web#react-scripts#react-app-polyfill" depends on it.
info Disk size without dependencies: "6.63MB"
info Disk size with unique dependencies: "6.63MB"
info Disk size with transitive dependencies: "6.63MB"
info Number of shared dependencies: 0
=> Found "react-swipeable-views-utils#core-js@1.2.7"
info Reasons this module exists
- "_project_#social#react-swipeable-views#react-swipeable-views-utils#fbjs" depends on it
- Hoisted from "_project_#social#react-swipeable-views#react-swipeable-views-utils#fbjs#core-js"
info Disk size without dependencies: "4.37MB"
info Disk size with unique dependencies: "4.37MB"
info Disk size with transitive dependencies: "4.37MB"
info Number of shared dependencies: 0
=> Found "create-react-class#core-js@1.2.7"
info Reasons this module exists
- "_project_#server#react-s3-uploader#create-react-class#fbjs" depends on it
- Hoisted from "_project_#server#react-s3-uploader#create-react-class#fbjs#core-js"
info Disk size without dependencies: "4.37MB"
info Disk size with unique dependencies: "4.37MB"
info Disk size with transitive dependencies: "4.37MB"
info Number of shared dependencies: 0
=> Found "glam#core-js@1.2.7"
info Reasons this module exists
- "_project_#server#react-images#glam#fbjs" depends on it
- Hoisted from "_project_#server#react-images#glam#fbjs#core-js"
info Disk size without dependencies: "4.37MB"
info Disk size with unique dependencies: "4.37MB"
info Disk size with transitive dependencies: "4.37MB"
info Number of shared dependencies: 0
=> Found "@babel/register#core-js@3.1.4"
info This module exists because "_project_#social#react-native#metro-babel-register#@babel#register" depends on it.
info Disk size without dependencies: "6.69MB"
info Disk size with unique dependencies: "6.69MB"
info Disk size with transitive dependencies: "6.69MB"
info Number of shared dependencies: 0
=> Found "apollo-env#core-js@3.1.4"
info This module exists because "_project_#server#apollo-server-testing#apollo-server-core#@apollographql#apollo-tools#apollo-env" depends on it.
info Disk size without dependencies: "6.69MB"
info Disk size with unique dependencies: "6.69MB"
info Disk size with transitive dependencies: "6.69MB"
info Number of shared dependencies: 0
What is the expected behavior?
In this case the core-js module should survive bc it's a transitive dependency based on a dependency as opposed to a devDependency. Since core-js is a transitive dependency for both dev and normal dependencies, yarn may be too aggressive here.
Please mention your node.js, yarn and operating system version.
yarn 1.17.3
node 10.15.3
os mac os High Sierra
Do you want to request a feature or report a bug? bug
What is the current behavior?
yarn install
respects a nohoist key on the root package.json that allows you to deal with modules that would create problems when hoisted. In my case core-js v2 ends up in the root and core-js v3 ends up in a package node_modules.When you run
yarn install --production
, the package specific node_modules core-js is removed.Subsequently v3 specific imports fail.
core-js is normally a transitive dependency, so this behavior leads me to believe that there is a bug here.
If the current behavior is a bug, please provide the steps to reproduce. I have included an output of yarn why core-js output
nohoist part
What is the expected behavior? In this case the core-js module should survive bc it's a transitive dependency based on a dependency as opposed to a devDependency. Since core-js is a transitive dependency for both dev and normal dependencies, yarn may be too aggressive here.
Please mention your node.js, yarn and operating system version. yarn 1.17.3 node 10.15.3 os mac os High Sierra