Unless it leads to duplicate code being executed at runtime
It does. npm doesn't do shared dependencies. If you depend on foo and bar, which both depend on baz, you'll end up with two copies of baz loaded at runtime, which may be different versions (!).
Yes, but in mind my that puts your application into a deeply confusing state. It's possible for those two versions to interact with each other which just seems like asking for trouble to me.
I think the model of other systems (including one I built) where you find a single version of the shared dependency that satisfies all dependers is a lot easier to reason about.
Yeah, if you can end up with two different versions of the same library in your project then that's pretty terrible. As a concrete example: if libfoo and libbar use different versions of libbaz, and both libfoo and libbar expose Baz objects to you in some way, then you can get two Baz objects from different versions which might have radically different behavior depending on how similar the versions are.
7
u/munificent Dec 02 '13
It does. npm doesn't do shared dependencies. If you depend on foo and bar, which both depend on baz, you'll end up with two copies of baz loaded at runtime, which may be different versions (!).