question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Move to peer dependencies

See original GitHub issue

Right 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:open
  • Created 6 years ago
  • Reactions:1
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
VanTanevcommented, Jul 30, 2017

@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 ?

1reaction
leocaseirocommented, Jul 30, 2017

If we have break changes, we should 2.x it is.

Sounds good to me.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found