Hacker News new | past | comments | ask | show | jobs | submit login

Jspm solves this by installing the module in a directory appending the package version. There is no maximally flat tree, the tree is 100% flat. At most there are several versions of the same package side by side, but no nesting.

It even supports circular dependencies.




Are there any trade-offs to this approach? This seems so obvious to me I'm confused why it is more widely used.


In node, require()'ing a dependency is stateless - it searches ./node_modules/ for the module, then ../n_m/ then ../../n_m/, etc, until it finds an appropriately named module.

In JSPM/SystemJS, require()'ing/importing a module is still by name (as it supports NPM modules), but the package.json file has to be parsed in order to map module names to an installed module version. Note, this mapping is only done in the developer environment - once you build a bundle all the mapping is statically compiled into one file.


Wow. Thanks for opening my eyes to do that. I was wondering why I would use another package manager.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: