- Mar 2021
-
yarnpkg.com yarnpkg.comLexicon1
-
Peer dependency A dependency (listed in the peerDependencies field of the manifest) describes a relationship between two packages. Contrary to regular dependencies, a package A with a peer dependency on B doesn't guarantee that A will be able to access B - it's up to the package that depends on A to manually provide a version of B compatible with request from A. This drawback has a good side too: the package instance of B that A will access is guaranteed to be the exact same one as the one used by the ancestor of A. This matters a lot when B uses instanceof checks or singletons.
Tags
Annotators
URL
-
- Nov 2020
-
github.com github.com
-
I have also added svelte under peerDependencies
Tags
Annotators
URL
-
- Oct 2020
-
github.com github.com
-
Only peer dependencies: Svelte and Final Form
-
-
github.com github.com
- Sep 2020
-
stackoverflow.com stackoverflow.com
-
The automatic install of peer dependencies was explicitly removed with npm 3, as it cause more problems than it tried to solve.
-
-
-
You probably do want angular to be a peerDependency, since it is a framework within which your code runs.
Tags
Annotators
URL
-
-
engineering.mixmax.com engineering.mixmax.com
-
But this is only a halfway decent way to clarify that this is an external dependency, because the only way to resolve a peer dependency warning is to install react from npm—there's no way to notify npm that you resolve the dependency to a browser global. So peer dependencies should be avoided in favor of external declarations. Then Rollup will take care of warning about "unresolved dependencies", even if external declarations can't express a particular version range with which your library is compatible like peer dependencies can.
Interesting. Didn't realize. From my perspective, I usually do install packages via npm, so wouldn't have known about this problem.
npm and rollup both try to solve this problem but in different ways that apparently conflict? So if a lib author lists peerDependencies then it can cause problems for those getting lib via browser (CDN)? How come so many libs use it then? How come I've never heard of this problem before?
-
You oftentimes see packages list react as a peer dependency. Since this prevents react from being installed into that package's node_modules, this is another way of preventing Rollup from bundling the module. This is also nice _if_ you want the application to install react from npm, because if an application forgets to install a peer dependency, npm will issue a warning.
-
-
nodejs.org nodejs.org
-
www.changelogs.md www.changelogs.md
-
Move svelte into dependencies, as it was accidentally stuck in peerDependencies
"accidentally stuck in": well, not really accidentally; it's in the change log so I assume it was intentional
-
Move svelte to peerDependencies
-
-
codingwithspike.wordpress.com codingwithspike.wordpress.com
-
Then it would tell NPM that “if a package lists me as a dependency, then assume that package also has a dependency on PackageB”.
-
To make this “if you install me, you better also install X, Y, and Z!” problem easier, peerDependencies was introduced.
-
-
flaviocopes.com flaviocopes.com
-
peerDependencies are different. They are not automatically installed. When a dependency is listed in a package as a peerDependency, it is not automatically installed. Instead, the code that includes the package must include it as its dependency.
Tags
Annotators
URL
-
- Dec 2019
-
github.com github.com
-
Required Peer Dependencies These libraries are not bundled with Reactstrap and required at runtime:
-
-
github.com github.com
-
For React components projects, it's expected that they will not have a direct dependency on React/React DOM/prop-types, but instead have them as peer dependencies.
-
-
github.com github.com
-
peerDeps can't be disabled. If someone wants to create a neutrino-preset-preact based on the react preset, they won't be able to get rid of the warnings.
Tags
Annotators
URL
-
-
github.com github.com
-
The one thing I did have to change to get them to work, was adding the neutrino peerDependency additionally as a devDependency, since apparently that's the recommended way to ensure it's installed. OAO's behaviour of automatically installing peer dependencies does not occur in {npm, yarn, lerna} by design (see lerna/lerna#691, npm/npm#11213 and https://docs.npmjs.com/files/package.json#peerdependencies).
-
- Nov 2019
-
github.com github.com
-
peerDependencies
-
-
github.com github.com
-
Peer Dependencies react-hooks-testing-library does not come bundled with a version of react or react-test-renderer to allow you to install the specific version you want to test against.
-
-
www.npmjs.com www.npmjs.comts-mocha1
-
This package does not include Mocha - I have set Mocha as peer dependency on purpose, so I don't lock consumer to a specific Mocha version but most importantly, I don't have to update this package when Mocha is updated, and all the new features will be available automatically from your local Mocha package.
Tags
Annotators
URL
-
- Nov 2018
-
nodejs.org nodejs.org
-
As a package manager, a large part of npm's job when installing your dependencies is managing their versions. But its usual model, with a "dependencies" hash in package.json, clearly falls down for plugins. Most plugins never actually depend on their host package, i.e. grunt plugins never do require("grunt"), so even if plugins did put down their host package as a dependency, the downloaded copy would never be used. So we'd be back to square one, with your application possibly plugging in the plugin to a host package that it's incompatible with.
in other words, a peer dependency enables a kind of reverse dependency. so a plugin to appA can this way 'require' that appA would be of a specific version, not as its own dependency but rather as a neighbour or parent package.
Tags
Annotators
URL
-