|
|
|
|
|
by rShergold
1741 days ago
|
|
It seems to be really common to sling mud at the JavaScript/NPM ecosystem from developers who work in other domains. One of the big constraints we have in front end development is that every added feature adds to the bundle size of code we have to send down the wire to the end user. When I worked in mobile app development third party libraries tended to be very large with many many features. Only a tiny fraction of that library ends up matching your use case. However when you build you end up bundling up the whole thing into your app. JavaScript has more of a culture of many many small hyper focused packages. The logical conclusion being single function packages like left pad. This has two benefits. One - you have less dead code in your final build. Two - if one of your dependencies is already using leftpad you essentially get to use it "for free". If everyone did what you are suggesting you would find multiple instances of leftpad. One version you wrote. One version your dependency wrote. One version your dependency's dependency wrote etc. |
|
Surely there have to be tools to process dependency libraries to strip out any unused code.