TLDR
Support is still experimental. Most things work as expected out of the box with a Front End application, but it had a lot of issues with Node...
For further actions, you may consider blocking this person and/or reporting abuse
With node it's as easy as
-r esm
. I have a hard time fathoming why everyone doesn't do this.As a community, we need to stop letting node's indecision (as justified as it may be) hold us back.
Agreed.
How many people know what goes into the bundle when you write
import React, { Component } from "react"
and run it through a transpiler?
How many people (besides the JS disciples) will care if it's .mjs or .js or .esm?
Now, I'm aware that there are proper geniuses in TSC, and they must have discussed this ESM thing over and over. Yet they could only come up with a new extension?
From what I could gather, the main reason for that is "backwards compatibility with commonjs". Compatibility with something that is essentially a collection of hacks?
This is the official spec, not what people made do with in the past. Who thought it was a good idea to use cjs in .js yet esm in .mjs? It should actually be the other way around, if you really want to keep the extension.
FWIW, I think the best way forward was to add something like
"use modules"
at the module level.
I'm not a fan of how node is implementing the feature, I think I'll stick to transpiling with babel. Everything works fine with that.
Why not just transpile esmodules with babel? Best of both worlds
That is always an option, I wanted to explore the idea of not doing it anymore.