Feature request: Avoid loading linked modules multiple times
See original GitHub issueWe run into the following issue with quite a large dependency tree:
When linking packages with npm link
that share a dependency, Browserify loads the module twice because they are in different paths. This leads to various problems from multiple socket connections to instanceof
not working anymore.
It would be great if Browserify could consider the package.json’s name / version to detect this case.
Thanks!
Issue Analytics
- State:
- Created 10 years ago
- Comments:23 (10 by maintainers)
Top Results From Across the Web
Customize Angular lazy loading modules for multiple frontends
In this article, we will explore how to build an Angular app with multiple frontends by utilizing lazy loading feature modules and dynamic ......
Read more >Common modularization patterns - Android Developers
This page gives an overview of some general rules and common patterns that you can employ when developing multi module Android apps.
Read more >What Happens When a Module Is Imported Twice?
A JavaScript module is evaluated just once. When imported multiple times from the same path, the same module instance is returned.
Read more >Lazy Loading Angular Modules and Preloading Strategies
It loads only the components that are required to render the page. This saves time and renders the application much faster than eager...
Read more >Duplicated Vue runtime while loading vue library modules ...
You will need two Vue projects, one will need be a library, the other a standard Vue project. ... This indicates more than...
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
Finally found a reusable solution to the problem of duplicated deps when
npm link
ing, and it’s not specific to any build tool: http://stackoverflow.com/a/36464203/222356In short, remove secondary dependencies from the
npm link
ed module, add your downstream project’snode_modules
toNODE_PATH
, and resolve secondary dependencies in your downstream project.e.g.
NODE_PATH=$(pwd)/node_modules/ npm start
Curious to hear your thoughts.
I found the solution @ericsoco suggested to work perfectly without requiring any project changes.
For future readers, to make this fit into our existing workflow I put together a node module you may find useful and save you some keystrokes: https://github.com/oztune/gn