0

In our project we have a node app (=A) that integrates a library (=B) that we use. Both in the host (A) and in the lib (B) we use a library from third parties (lets say super-lib@1.0.0 =C), so also in the same version.

So A's package.json looks like this:

dependencies: {
    "B": "2.0.0",
    "C": "1.0.0"
}

The question now is whether you should/can do without C in A, since it is imported as a peer-dep via B anyway. Is there anything against it?

Looking forward to your answers :-)

EchtFettigerKeks
  • 1,692
  • 1
  • 18
  • 33

1 Answers1

0

It is recommended that you add the dependency ("C") in your project "A" if it is directly used in your project "A".

The reason is, we can make refactors to the project in the future and they might end up using different versions of the same dependency or one can be totally moved from one dependency to another. Consider example of request which is now deprecated but was widely used (directly or indirectly) and now your dependent projects are moving away from it but your main project is still using it. You might end up with a missing dependency in your project.

Brijesh Bhakta
  • 1,280
  • 1
  • 8
  • 14