News for hackers. Stuff that matters.
Re:When Douglas Adams wrote about Hypercard by shadowgovt on Tuesday January 10, 2023 @03:30PM (#34331033)
Npm does one thing particularly clever that a lot of other library / dependency infrastructures fail at: it supports multiple versions of the same library living in the codebase.

Because npm treats package dependencies recursively, a package depending on v1 of another package and a package depending on v2 of that package can actually live in the same codebase (with proper configuration; it comes as kind of a side-effect of transpilation and tree-shaking requiring the toolchain to rename symbols anyway, so the two different versions of the library just end up either properly hidden via module inclusion or in the same codebase but name-mangled to different things). This isn't foolproof (if one of those libraries leaks details of its dependency, and another piece of code tries to do `instanceof`, it's going to have a bad time), but it makes it easier to work with codebases one doesn't control.

There are no comments on this comment yet.