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 some JS dependencies to peerDependencies

See original GitHub issue

Currently jQuery is listed as a package.json dependency that causes npm and webpack to give Materialize its own private copy of jQuery (living in its node_modules subdirectory). The result is that there are two separate jQuery versions in your project and Materialize’s jQuery plugins become unreachable.

Moving jquery to peerDependencies would solve the problem and would make Materialize share the single jQuery installation with the rest of the project it’s used in.

Hammer is listed as a package.json dependency but it’s also bundled in compiled files in both dist and bin. For projects that wish to use Materialize as an npm package this is quite wasteful and leads to code duplication.

Moving hammerjs to peerDependencies and either removing it from the compiled copy in dist or (preferably) providing a commonjs entry point to the original code in js directory would solve this.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:9
  • Comments:13 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
fegacommented, Jul 12, 2017

@Dogfalo it makes sense?

also @tomscholz the peerDependencies are not deprecated, the only deprecation was a change of the behavior of the package manager, that doesn’t install the packages in peerDependencies automatically.

1reaction
arlowhitecommented, Oct 6, 2016

Also, there’s:

  • js/jquery.easing.1.3.js
  • js/velocity.min.js
Read more comments on GitHub >

github_iconTop Results From Across the Web

Understanding Peer Dependencies in JavaScript
Peer dependencies really come into play when you're developing code that will be used by others, such as plugins and packages. If you're...
Read more >
How to add npm dependency as peer dependency
npm i -D dep adds the dependency to the "devDependencies" in package.json. How do I install a dependency that adds it to the...
Read more >
npm Peer Dependencies - JavaScript inDepth
A Dependency is an npm package that our package depends on in order to be able to run. Some popular packages that are...
Read more >
Understanding and organizing dependencies in node packages
To avoid this, consider moving your dependencies to devDependencies or peerDependencies instead. DevDependencies. DevDependencies, or ...
Read more >
What are peer dependencies in a Node module? - Flavio Copes
... Next.js and much more! ✨. In some package.json files, you might see a few lines like this: { //... "peerDependencies": { "libraryName": ......
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