This repository has been archived by the owner on May 1, 2024. It is now read-only.
Peer dependencies semantics #615
Replies: 1 comment 4 replies
-
A package's peerDependency requirement is hoisted up the tree (to the top, i think?). It is required to be present, and to satisfy the provided version range. Plugin systems use peer deps, but it doesn't seem right to be to apply plugin terminology to peer deps themselves. Typically, the "core" of a plugin system is peerDepended-on by everything in the plugin ecosystem, except the top-level apps consuming them, which declare the "core" as a runtime or dev dep explicitly. An example is react: nothing should runtime-depend on React except a top-level app, and anything else that interoperates with React must peer-depend on it. |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I wonder what is semantic of peer dependencies? The official documentation explains peer dependencies only briefly as a way to install a plugin package along the compatible version of a host package. What does along mean in this context, does it mean that plugin can
require
host and should find a compatible version, or does it mean that the parent ofplugin
can require host and find a compatible version specified by plugin? What should you do to ensure a specific peer dependency version, should you provide host as a dependency only in the direct parent of a plugin, or you can do it by providing host in any parent up in the graph, or maybe you can provide host in an arbitrary place in the graph not necessarily in any of the parents?The confusion around peer dependencies semantic is here with us from npm 1 and up to this day, the confusion only increases with changes around peer dependencies semantic from one npm version to the other and it is not clear what peer dependencies are really meant to be?
Beta Was this translation helpful? Give feedback.
All reactions