I try not to think about that JS tooling too hard, lest I start pulling my hair out and devolve into a screaming crazy person.
I try not to think about that JS tooling too hard, lest I start pulling my hair out and devolve into a screaming crazy person.
It's just that this problem can't be solved entirely by npm. Node has to make changes to it's module loader as well.
node_modules/
a/
node_modules/
c/ (1.0.0)
b/
node_modules/
c/ (1.0.0)
c/ (2.0.0)
Both a and b depend on c version 1.0.0, but since there's a version 2.0.0 in the root node_modules folder c can't be placed there, and has to be duplicated in a and b's own node_modules folder, otherwise Node couldn't find it for each of them. node_modules/
versions/
a@1.0.0
node_modules/
c -> ../../c@1.0.0
b@1.0.0
node_modules/
c -> ../../c@1.0.0
c@1.0.0/
c@2.0.0/
a -> versions/a@1.0.0
b -> versions/b@1.0.0
c -> versions/c@2.0.0Great idea though, and it probably has improved a bunch since then.
This is one of the reasons why I love the JS ecosystem. You can even choose among a few tools you use to install packages from a package manager.
I used it successfully in a project and it even worked with native modules.
Looks like it is supported now:
https://github.com/alexanderGugel/ied/issues/7#issuecomment-...
Maven repositories have following structure, that allows to avoid duplication and take versions into account: /<vendor namespace>/<library>/<version>/<library artifact.ext>
Vendor namespace itself is hierarchical and usually related to domain name, e.g. "com/mycompany/myapp".
No idea, why this approach is not yet used in JS world (except the webjars), but it's high time to fix it this way.