Skip to content

Improper hoisting of peerDependencies: webpack, ajv, ajv-keywords #3933

@CrabDude

Description

@CrabDude

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

What is the current behavior?

  1. (Top-level) foo lists dependencies:
    • bar@5
    • baz
  2. baz lists peerDependencies bar@5.
  3. (Top-level) qux & quux list dependencies bar@4
    • Causes bar@4 to hoist, invalidating baz's peerDependency of bar@5)

The result is the following tree:

├─foo
│   └─bar@5
├─baz // (Why is this hoisted? Causes invalid bar peerDependency)
├─bar@4 // (due to qux & quux)
├─qux
└─quux

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

// In empty directory
$ yarn add  [email protected] [email protected] [email protected]
$ yarn check
yarn check v0.28.1
[...]
error "webpack#ajv-keywords#ajv@>=5.0.0" doesn't satisfy found match of "[email protected]"
[...]
error Found 1 errors.

What is the expected behavior?

Don't hoist dependencies (i.e., baz & ajv-keywords) w/o hoisting peerDependencies (i.e., bar & ajv).

In the example above, ajv-keywords should not be hoisted, and left as a sub-dependency of webpack.

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

[email protected]
[email protected]

Related:

#3465
#2688

Dupes:

#3916
webpack/webpack#5262

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions