Move to peer dependencies
See original GitHub issueRight now, we have jquery
, angular
and chosen-js
as normal dependencies.
Especially for angular
and jquery
, this is a big issue when used with packers like webpack, because it might force the packer to include 2 versions of those huge libraries - the user-defined one in their package.json
and ours. This will happen when the 2 versions are not semver compatible, which is quite easy to fall into.
I would say that we definitely want to move those two to a peerDependency
.
For more on peer deps: https://nodejs.org/en/blog/npm/peer-dependencies/
Edit: As an aside, I’m not sure that we’re using jQuery v3+ methods? Any reason for pinning to that instead of ^2.0
? chosen-js
itself supports ^1.4
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:5 (3 by maintainers)
Top Results From Across the Web
How to add npm dependency as peer dependency
Move the installed package name to peerDependencies key. "peerDependencies": { "@angular/core": "^7.0.0" }.
Read more >Understanding Peer Dependencies in JavaScript
When to use peerDependencies? Peer dependencies really come into play when you're developing code that will be used by others, such as plugins ......
Read more >npm Peer Dependencies - JavaScript inDepth
Peer Dependencies are used to specify that our package is compatible with a specific version of an npm package. Good examples are Angular...
Read more >Was moving request to peerDependencies the best choice?
My understanding is peerDependencies was a poor man's solution to the real solution that the latest npm uses - it always installs dependencies ......
Read more >Automate peer dependency management - Katy DeCorah
Save devDependencies as peerDependencies in each configuration package. We moved all the devDependencies that are required to allow the ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@leocaseiro The change itself is trivial, but we need to make a decision about semver - does this change necessitate bump to 2.0?
Changing a dependency to a peerDependency means that it will no longer be installed with current versions of npm/yarn unless it’s present in the user’s own
package.json
. While that is the desired behavior for a plugin, we might have users that depend on it and who might end up with broken projects after the change.It’s kind of unfortunate that such a small fix might necessitate a major version bump, but then again, numbers are fairly cheap. Maybe we just take the jump and do version 2.0 ?
If we have break changes, we should 2.x it is.
Sounds good to me.