Home computickets Why do you need "peerDependencies"?

Why do you need “peerDependencies”?

Author

Date

Category

I make the expansion of the class, which in turn is the expansion of the other. Let it be BASE and EXTENSION .
My project depends on the package containing extension with the peerdependencies Package with the class Base .
It seems that without installing the dependence in its project specified there, I can not collect it in WebPack.
Explain when peerdependencies is used, why don’t you specify dependency, for example, in DEV ? Why, if the dependence is already available, I need to create a new one?


Answer 1

DevDependencies indicate dependencies for programmers, that is, you need directly to change the code or resources. In particular, it includes all the packages required to compile code.

Dependencies indicate dependencies required for the functioning of the package.

happens, different plugins require different versions of one package. Such packages are added to PeerDependencies. As a rule, NPM itself adds packets with the necessary versions when it finds different versions among secondary dependencies or cyclical dependencies. Manually adding them there meaningless. And who will want to pick up in other people’s codes.

source

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions