3 ms·
Javascript has a problem unique among all the other languages toolchains. It's primary use is to ship to a browser. However shipping an entire string-util libr
by zaphar 11y ago
Javascript has a problem unique among all the other languages toolchains.
It's primary use is to ship to a browser. However shipping an entire string-util library because you need a string prefix function is wasteful and bad engineering. But javascript doesn't have dead code elimination anywhere in it's toolchain unless you use Closure. And that really only works well if all of your dependencies are using Closure as well.
As a result of all this javascript needs a poor mans dead code elimination at the package manager level. Including a package only includes the code you will actually use. This helps to keep your javascript code that you send to the browser small. What works for Java or C++ won't work here for the above reasons.
This isn't npm's fault, it's intrinsic to javascript the language and it's primary target platform the browser.