Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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.




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

Search: