-
Notifications
You must be signed in to change notification settings - Fork 43
The future of .mjs #57
Comments
Experimental flags should be used only to ... well, experiment. This group exists because of the many discussions around the current status so that until it's "done", the only official statement should be: it's experimental and under discussion, don't use it in production. That being said, and AFAIK, the current status is that there was some work done behind Same goes for info in OT: I like how everyone in that discussion ignored |
As far as I understand (from the TSC discussion I've read)
That's because TypeScript already has modules (as pretty much the only option) and since TypeScript is built (ahead of time) it wouldn't be necessary. |
maybe my answer was a bit too convoluted but I meant exactly this when I've written:
yet my point is that until it's under discussion, including the exploring other options bit, it doesn't make much sense to ask "a confirmation around how Locking external libraries/superset/languages over |
ideally node's mode will be set such that .js is by default and we can use package boundaries and such and the only time you'll need mjs is when you want to mix cjs/esm in your source code |
Yep, as it is now |
As much as I believe that I think it would be ideal to avoid implementing |
It is worth mentioning that many of us in this thread are representing our own views, as the modules team has not made any official recommendations to the project yet in regards to extensions. As someone who has been involved in this for a while I do feel safe saying that ".mjs" is here to stay. It is easy to conflate ".mjs" with interoperability concerns, but no matter how we decide to do ESM + Common.js interop there is a need for an out of band mechanism for unambiguous modules. There is of course a potential future where ".mjs" is not adopted, but I personally don't see that happening. @jpike88 do you consider your question answered? I think it would make sense to close this issue for now. |
Thanks for your answers. I'm also closely following the discussions around ES modules in Node. Even if I personally think that |
@demurgos I think @ljharb answered that already: |
Perhaps it's worth adding more information to the startup message when the flag is used? I've just done (probably the smart thing) a downgrade from using .mjs to using the esm loader... thing is it's taken me like 6 months to realise that it's the same thing. I'm not stupid, I promise. Close for now, but my journey has ended using esm, converting everything back to .js and running with it has been painless and TypeScripe works solid with it. Thanks all... |
Okay, I just wanted to be sure that "while it's still flagged in node." referred to Node 10 too. |
good choice for the time being since whatever happens esm can catch up beside node releases
yeah, |
So I'm aware this is all still under the experimental flag and recognise its status as a result.
However, a fair amount of discussion is taking place across TypeScript and babel regarding where to direct attention with regard to modules.
microsoft/TypeScript#18442
A major point of uncertainty is whether or not the current ES Modules 'mode' and .mjs will continue on.
For what I can see, it seems like .mjs is here to stay. The goal of having a unified set of functionalites under a single file extension is obviously where you want to go, but .mjs/ES mode seems like the 'stepping' stone that will eventually make that a reality.
Is it possible to get a confirmation around how .mjs is to be treated, so basic file extension support can be approved with the caveat of it being experimental?
I'm one of I'm guessing many who have run with .mjs based projects, and would love to see a clear directive on this. It's been a long time coming I think.
The text was updated successfully, but these errors were encountered: