Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

>The type is set to module. This has something to do with the migration from requires to imports. Why do we have to care about this, again? The extensive pain you’ve experienced trying to importing ES5 modules from ESM modules and vice versa overwhelms you again.

Would anything truly have been lost if Node simply ignored ESM?

The half-measure seems, abstractly, worse than announcing that Node was all-in on ESM, deprecating CJS by a certain LTS release, as the end-user has no real notion of the ultimate destination of ESM in a Node project; what is the struggle for?.



Jarred says it best: https://bun.sh/blog/commonjs-is-not-going-away

- 75% of NPM is CommonJS

- It’s better for lazy loading / cold start outside the browser than `await import(…)`


ESM has nice things too, like top-level-await and strict mode by default. Explicit imports/exports are better for autocomplete when TS is unavailable.

I think the ESM slowness can eventually be compensated for but it will need spec changes. Possibly the defer import proposal.

But yeah, CommonJS is basically never going away.


Progress, the one thing JS has too much of, too quickly, without stabilizing for quality.

There are a number of benefits (see the link below). We could argue JavaScript shouldn’t be isomorphic, as it barely does its job well on either end. Node might in fact be better off without the ‘pollution’ of client-side packages, but well…

https://www.reddit.com/r/node/comments/rby64z/why_esm_what_d...


> Progress

It's lack of quality.

When you have a badly designed layer, you have a lot of problems to progress over. And each bit of progress creates a whole lot of new problems you can solve with further progress.


Thing is, Browser JavaScript projects tend to implicitly rely on CJS hacks, such as Jest, as the article points out, or, and correct if I'm wrong, most popular HRM implementations.


I think it has to do with Node.js using Chromes JavaScript engine called V8. So whatever V8 does, node.js must do too.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: