As far as I understood, peerDependencies are used to express the compatibility to another package without actually requiring it. From v7 onwards all peerDependencies are installed by default when running npm install. I was wondering why they are all installed by default. Isn't it a waste of resources to install an entire package without requiring it? Wouldn't it be enough to make an entry in package-lock.json and check the compatibility of the transitive dependencies (= the peerDependency dependencies)? What am I missing?
Asked
Active
Viewed 192 times