-
Notifications
You must be signed in to change notification settings - Fork 66
Conversation
|
||
The RMR poses several interoperability and tooling problems: | ||
|
||
1. Importing from NCJS has no support for Named Imports. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is unfortunate :-( i think it's an OK thing to sacrifice, but basically everyone using babel right now to named-import from CJS is going to break.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: this is a problem with using the RMR which this proposal avoids, these are not problems with this proposal. :)
(Also saying for anyone else reading this.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, understood. Thanks for clarifying!
I don't really see the point. If async loading is such an issue, I would prefer to have CJS scripts not able to load modules than to have half implemented ES modules. ES module developers would still need to publish a transpiled version but they would be able to run their module natively. |
@dinoboff See the discussion at #43 (comment) In summary, new ES Features will likely only target the Module Parse Goal, and as such it is a good idea to make it available, even if it is not within ES Modules due to problems with them.
Hmmm 💭 I don't think this ever claimed to be that. This claims to implement the Module Parse Goal while specially not implementing ES Modules in the loading / import / export sense, since there is many problems with that. |
4099338
to
bda6011
Compare
Updated with some more problems with Spec ES Modules and addressed some comments. |
Also a note which I don't know where to put yet: This retains "top-level" |
That's not part of the module goal though. There isn't supposed to be a top-level return, and I'm not sure why that's valuable in CJS modules anyways. |
*sigh* rebased ontop of nodejs#39
bda6011
to
b56ee22
Compare
Updated with an example for |
@Fishrock123 Node could support three types:
With the two loaders supporting or not each other. This proposal doesn't need to be a rewrite of 002-es-modules; why not a 004-cj-modules proposal? |
@dinoboff unsure if that would be useful. |
If we can get top-level await, we could just do something like |
@Qard not sure I understand, |
I understood top-level async/await as having await everywhere and, when used outside an async function, would halt the entire JS thread. Perhaps I misunderstood it, but it seemed like a lot of people had the same understanding of it. Alternatively, a function on promises to block until resolution would help too, like a thread join. Though I'm not sure how that'd impact other things in the microtask queue, and I somehow doubt TC39 would be into that idea... |
|
There could be the option of having a syntax extension where a call to It would still not be completely transparent, though, as it'd break |
Ah, in that case...IGNORE ME. |
closing, agreement has come around to other options |
My, possibly transitional, "counter-proposal" to #39.
Mostly hashed out, some details may be missing as this style of thing is not my forte.
This is what is roughly described in a recent meeting with other CTC members.
It is driven by an interest of our existing ecosystem, to maintain as much compatibility with everyone's existing hard work as possible, while allowing newer functionality to be used without major consequence.
Like many other things in node core, it is a compromise. A compromise from idealism to better suit the reality of our platform.
cc @bmeck, @ljharb, @nodejs/ctc i guess
Dear lord I hope this doesn't gather a ton of hate.
Edit: this is rebased on #39 for some language simplicity reasons. I can probably merge those directly into his commit though.