0

Would someone please tell me if am or am not suppose to put a package into both areas.

For example if I have in dependencies '@asymmetrik/ngx-leaflet-draw...' and it has a peer dependency of 'leaflet-draw...' am I to place the leaflet-draw into the peerDependencies as well as the dependencies area?

edjm
  • 4,830
  • 7
  • 36
  • 65
  • 3
    [This one](https://stackoverflow.com/a/22004559/12032180) is great explanation about dependencies. – jad Sep 20 '19 at 15:48
  • 1
    Possible duplicate of [What's the difference between dependencies, devDependencies and peerDependencies in npm package.json file?](https://stackoverflow.com/questions/18875674/whats-the-difference-between-dependencies-devdependencies-and-peerdependencies) – nircraft Sep 20 '19 at 17:01

1 Answers1

2

I had this question as well and I think the answer is yes. I had conflicts with minor versions of rxjs (lots of type errors):

A depends on rxjs
A depends on B

B depends on rxjs

This would often result in two slightly different versions of rxjs being installed. So I tried this:

A depends on rxjs
A depends on B

B peer depends on rxjs

But when running tests etc for component B it was complaining that rxjs wasn't installed, so now I have:

A depends on rxjs
A depends on B

B depends on rxjs
B peer depends on rxjs

Works so far. The weird thing was that the version specification for rxjs in both projects would have allowed the same (latest) version of the library to be installed but npm/yarn still ended up installing two different copies.

contrebis
  • 1,287
  • 1
  • 11
  • 20