News for hackers. Stuff that matters.
Re:Yarn – A new package manager for JavaScript by kzahel on Tuesday October 11, 2016 @11:38AM (#12685375)
"The React Native package.json currently lists just 68 dependencies, but after running npm install the node_modules directory contains 121,358 files."

That, to me, is what is wrong with npm. The problem stems from node.js not coming with "batteries included" so there is a proliferation of tiny libraries that do the most trivial things.

Re:Yarn – A new package manager for JavaScript by christophilus on Tuesday October 11, 2016 @12:18PM (#12685803)
Yeah. Inspecting the node_modules folder for pretty much any front-end project is depressing. Still, I prefer npm to no package manager at all.

One problem is that packages often bundle everything, rather than including an npmignore. I'm guilty of this myself.

Do you think that the problem of over-dependence is reversible, and if so, how?

Re:Yarn – A new package manager for JavaScript by sotojuan on Tuesday October 11, 2016 @12:10PM (#12685718)
90% of those files are probably Babel-related.
Re:Yarn – A new package manager for JavaScript by mschuster91 on Tuesday October 11, 2016 @01:18PM (#12686380)
> That, to me, is what is wrong with npm. The problem stems from node.js not coming with "batteries included" so there is a proliferation of tiny libraries that do the most trivial things.

This is in no way a fault of node.js but of the whole JS standard. People these days use npm modules to run in a browser and ship stuff bundled together with webpack (or other bundlers), so even if nodejs had a proper stdlib, you'd still need to depend on a polyfill so that your stuff works in a browser environment, too.

And due to the fact that even if a sane stdlib would ever be standardized, it would take YEARS of time until it reaches significant market share (looking at you, Android, Safari and IE), so you'd always have to ship a polyfill.

Re:Yarn – A new package manager for JavaScript by lukeschlather on Tuesday October 11, 2016 @01:26PM (#12686468)
That's kind of a red herring when it comes to NodeJS. Webpack and the 50 other tools you need to run it are in a completely controlled environment. Most of the build tooling is working around issues with NodeJS, and NodeJS doesn't need to wait for anyone to come up with improved APIs around filesystem interactions and build tooling. This is purely build-time stuff.
Re:Yarn – A new package manager for JavaScript by jay_kyburz on Tuesday October 11, 2016 @06:39PM (#12689102)
Yeah, but we could have a big, standard library polyfill, and it would quickly find its way into everybody cache, just like jQuery.
Re:Yarn – A new package manager for JavaScript by toefraz on Tuesday October 11, 2016 @11:20PM (#12690229)
We do. It's called Lodash.
Re:Yarn – A new package manager for JavaScript by deckard1 on Tuesday October 11, 2016 @11:44PM (#12690310)
To make matters worse, each package gets its own node_modules directory. Do a grep for 'async' in your node_modules. Mine contains ~20 instances of it. Some of those, probably, are the exact same version.

Going further down shit creek, each project I work on has its own node_modules. Which duplicates all of this crap, ad nauseam.

Do I really need React and Babel and jQuery and Webpack installed for every goddamn repo? You're not a package manager if you're not managing packages!! You're a glorified wget.

Re:Yarn – A new package manager for JavaScript by alessioalex on Wednesday October 12, 2016 @01:43AM (#12690651)
> To make matters worse, each package gets its own node_modules directory. Do a grep for 'async' in your node_modules. Mine contains ~20 instances of it. Some of those, probably, are the exact same version.

Upgrade to npm v3, that should these problems.

Re:Yarn – A new package manager for JavaScript by justinsaccount on Tuesday October 11, 2016 @12:15PM (#12685782)
As I understand it, the related problem is the poor support in build tools for dead code elimination which encourages people to publish libraries that contain a single function like left-pad.