Settings

Theme

ES Modules Are Terrible

gist.github.com

2 points by fjcero 3 months ago · 3 comments

Reader

pyramation 3 months ago

ES modules are cancer. I'm fine w the syntax — in fact, I love the syntax.

But if you use "module: true" in your package.json, you are splitting the npm ecosystem into two groups, and it's not moving us forward.

  • pyramation 3 months ago

    and fwiw, my opinion comes from attempting to upgrade packages that I've depended on that all of a sudden add the module: true, which essentially requires that ALL packages must upgrade — which is 99% of the time not possible because all the other deps are usually CJS.

    this is also similar to the non-incremental way TS rolled out in the early days, also causing knee-jerk reactions to TypeScript. However over time, devs found ways to incrementally type JS to TS, and so we've all mostly evolved by now.

    If ESM could do similar, allowing for incremental evolution, then it would solve all of the problems. I don't see why cjs and esm cannot co-exist

davydm 3 months ago

Yes, they are. And a pain in the ass when a dev can't get the package syntax right to import cjs when appropriate, but claim to support both targets. I literally patch hcaptcha locally to be able to build with it.

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection