Skip to content

Lockfile peer dependency flip-flops as different workspace packages are updated #3935

@anomiex

Description

@anomiex

pnpm version:

9.12.0, 10.0.0-alpha.2, 10.6.3

Code to reproduce the issue:

.npmrc:

dedupe-peer-dependents = false

pnpm-workspace.yaml:

packages:
  - 'a'
  - 'b'

a/package.json:

{
  "dependencies": {
    "terser-webpack-plugin": "5.2.4",
    "webpack": "5.61.0",
    "webpack-cli": "4.9.1"
  }
}

b/package.json:

{
  "dependencies": {
    "terser-webpack-plugin": "5.2.4",
    "webpack": "5.61.0"
  }
}

Steps to reproduce:

  1. Run pnpm install.
  2. In a, run pnpm update.
  3. Save a copy of pnpm-lock.yaml.
  4. In b, run pnpm update.
  5. Save a copy of pnpm-lock.yaml.

Expected behavior:

Saved copies of pnpm-lock.yaml are identical, as nothing has changed in the updates.

Actual behavior:

Saved copies differ. When update was last run in a, "terser-webpack-plugin@5.2.4(webpack@5.61.0)" shows a dependency on "webpack: 5.61.0(webpack-cli@4.9.1)". When last run in b, it shows "webpack: 5.61.0" instead.

Additional information:

  • node -v prints: v20.17.0
  • Windows, macOS, or Linux?: Linux

Notes:

terser-webpack-plugin has a peer dependency on webpack but not webpack-cli, which makes sense since it doesn't actually depend on the latter. webpack itself has an optional peer dependency on webpack-cli.

We've seen something similar with react-with-styles-interface-css, which has a peer dependency on react-with-styles but not react or react-dom, while react-with-styles itself does have peer deps on react and react-dom.

In our code in these two cases this doesn't seem to actually break anything, it just clutters our git diffs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions