Frontend javascript, on the other hand, has the DOM — the grand daddy of global shared state — making that approach much riskier. This makes it a much better idea for bower to reconcile (“flatten”, as they call it) all deps, shared or not.
So you want to write a package manager
sam boyer
18128
(Superb article. Just this nitpick:)
I don’t think this paragraph is right. Firstly, the DOM exists a single time, so multiple copies of a lib accessing is not typically an issue. The reason why, as far as I understand, Bower does aggressive flattening is because pushing a bunch of copies of a library to the client is a terrible waste of bandwidth.
Also, anecdotally, ‘happy diamonds’ can get quite bad. If you run recent versions of Babel (an ES6-to-ES5 compiler) with NPM2, its startup time is huge because it’s separated into a boatload of tiny packages all sharing the same dependencies, and ends up loading a crazy fractally repeating dependency tree.