-
Notifications
You must be signed in to change notification settings - Fork 29.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
module: remove --experimental-default-type #56092
module: remove --experimental-default-type #56092
Conversation
Review requested:
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #56092 +/- ##
=======================================
Coverage 88.00% 88.00%
=======================================
Files 656 656
Lines 189000 188927 -73
Branches 35995 35961 -34
=======================================
- Hits 166320 166265 -55
+ Misses 15840 15827 -13
+ Partials 6840 6835 -5
|
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.
While I understand this option is deemed unnecessary for now, from the notes I was unable to determine the underlying reasons.
Specifically, has it been decided that Node.js should never implement a flag to change the top-level interpretation?
And if not, why should we remove this now, and what would have to change in future, to reconsider such a flag?
Anyone coming back to this issue will probably want to know the answers to these questions, so it would be very useful to clearly state for reference.
No formal decision has been made; landing this PR would be effectively making the decision, but only until someone lands a PR to add the flag back. Decisions are never final. If you'd like more discussion at the TSC level perhaps we could add this PR to the TSC agenda and you could join the next TSC meeting? We know that flipping the default module system would be a breaking change to at least some (probably large) percentage of users, even years from now. I think the main question is: how would ESM-by-default be meaningfully different than the current status quo of syntax detection enabled by default, that would justify the disruption? I can't really think of any differences that users would notice, other than ambiguous ESM JavaScript loading without a warning to add the
The reasons to remove this are:
As for what would have to change in the future, in the various discussions (sorry, I can't find links) there was talk about potentially revisiting this and flipping the default several years from now, once the transition to ESM is truly far along and not just writing but also running CommonJS syntax is anachronistic; but per https://github.com/wooorm/npm-esm-vs-cjs#data we're still at something like two-thirds of most popular npm libraries being CommonJS, with movement of only about 4% in the past year. At this rate it will be many years before we pass the tipping point, though hopefully |
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.
lgtm 🎉
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.
One day, maybe :)
Landed in 94c327c |
PR-URL: #56092 Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Jacob Smith <jacob@frende.me>
Belated LGTM but I agree with #56092 (comment) - hopefully with |
This PR removes
--experimental-default-type
per the discussion and consensus at the November 2024 Dublin collaborator summit. This also follows the discussion in nodejs/TSC#1445 and related issues where it was decided that Node.js would not be flipping the default module system anytime soon, if ever, now that the use case of “run ESM syntax without needing to opt in” has been satisfied by module syntax detection. cc @nodejs/loaders