Skip to content

list and why report hoisting incorrectly. #5823

Open

Description

Do you want to request a feature or report a bug?

bug

What is the current behavior?

yarn list and yarn why will report a hoisted location for some packages that are incorrect. The package may not have been hoisted during install.

If the current behavior is a bug, please provide the steps to reproduce.

yarn init -y
yarn add react-scripts

note that babel-loader was installed under react-scripts

~/Projects/my-app 🐒   find . -name babel-loader
./node_modules/react-scripts/node_modules/babel-loader

However, yarn why babel-loader says it was hoisted (so should be located at ./node_modules/babel-loader

~/Projects/my-app 🐒   yarn why babel-loader
yarn why v1.6.0
[1/4] 🤔  Why do we have the module "babel-loader"...?
[2/4] 🚚  Initialising dependency graph...
[3/4] 🔍  Finding dependency...
[4/4] 🚡  Calculating file sizes...
=> Found "babel-loader@7.1.2"
info Reasons this module exists
   - "react-scripts" depends on it
   - Hoisted from "react-scripts#babel-loader"
✨  Done in 0.77s.

What is the expected behavior?

yarn why and yarn list should not report that this package has been hoisted.

The cause of this seems to be because PackageHoister prevents hoisting a package past it's peerDependencies (correct) however when running yarn list and yarn why the manifest for babel-loader does not contain the peerDependencies entry (incorrect) so it thinks the package can be hoisted (which it can't).

Please mention your node.js, yarn and operating system version.

yarn v1.6.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions