2 ms·
Oh god. There's so much I disagree with in this article. The most obvious: > And then I end up having to explain to them why, unlike CommonJS, it doesn't actua
by lelanthran 3y ago
Oh god. There's so much I disagree with in this article. The most obvious:
> And then I end up having to explain to them why, unlike CommonJS, it doesn't actually work everywhere yet, and may never do so.
Factually and speculatively incorrect.
I think all the major JS runtimes support it, and because it is standardised, those that won't in the future either probably are not being maintained anyway (and so won't be used in the future) or will level-up and add it in.
> And then people go "but you can use ESM in browsers without a build step!", apparently not realizing that that is an utterly useless feature because loading a full dependency tree over the network would be unreasonably and unavoidably slow
Not all browser code is a huge mess of spaghetti; sometimes you really just do want to use just one library to make your wordle game (or whatever). Even with a large deptree, CDN's and the browser itself can easily help reduce downloads by using cached files.
> And then, people go "but now we at least have a standard module system!", apparently not realizing that CommonJS was literally that,
No, it wasn't. It was not standardised. It was never something that you could assume was already in your JS implementation. Author also doesn't know what the meaning of "literally" is.
> And while the initial CommonJS standardization effort succeeded due to none of the competing module systems being in particularly widespread use yet, CommonJS is so ubiquitous in Javascript-land nowadays that it will never fully go away.
I doubt it. Non-standard things almost always lose out to the standardised equivalent. The writing is on the wall for any and all ES module equivalents.
> The vast majority of people who believe they're currently using ESM, aren't even actually doing so - they're feeding their entire codebase through Babel, which deftly converts all of those snazzy import and export statements back into CommonJS syntax.
And? At some point if you want to stop using some non-standardised extra tooling (switch to a babel competitor, for example) then using standardised constructs is much more future proof than directly spitting out CommonJS.
> This is a disaster, and the only remaining way I see to fix it is to stop trying to make ESM happen, and deprecate it in favour of some variant of CommonJS modules being absorbed into the spec.
I dunno who this guy is; maybe someone important in the JS world? Even if he is, though, this is an awfully arrogant viewpoint. ES modules have already happened, are already supported almost everywhere and works as intended.
Just what reason should there be for deprecating it completely? Just because one author is salty that he doesn't get to use his favourite library?
C'mon - we all have to move on when our favourite thing goes away. It's the way of the world, and having been programing professionally since the mid 90s, I too have had to let go of what I considered fantastic tech in favour of what I considered inferior tech.