[BUG] npm install @version removes the dep from peerDeps if dep is in devDeps as well (original) (raw)

Current Behavior:

running npm install on a dependency that is in both dev and peer deps removes the dep from peer. (note: this even happens if installing with the --legacy-peer-deps flag)

Expected Behavior:

if anything the peer dep should be kept over the dev dep, as the peer dep is part of the package's outward facing contract. preferably both are kept while legacy-peer-deps is an option.

Steps To Reproduce:

  1. create a package.json with a dep in both dev and peer
  2. run npm install <depname>@latest in the package
  3. notice that the dep is no longer in peer deps

Environment: