-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
Add --module node20
with require(esm)
support
#60761
base: main
Are you sure you want to change the base?
Conversation
Thanks for the PR! It looks like you've changed the TSServer protocol in some way. Please ensure that any changes here don't break consumers of the current TSServer API. For some extra review, we'll ping @sheetalkamat, @mjbvz, @zkat, and @joj for you. Feel free to loop in other consumers/maintainers if necessary. |
Looks like you're introducing a change to the public API surface area. If this includes breaking changes, please document them on our wiki's API Breaking Changes page. Also, please make sure @DanielRosenwasser and @RyanCavanaugh are aware of the changes, just as a heads up. |
I will probably release Node v20 with the backport for require(esm) around half of January 🙂 |
590892b
to
0dda037
Compare
Fixes #60534
require(esm)
is currently unflagged in Node.js v22, but may be in v20 by the time this PR lands for 5.8. We’ll have a discussion about the flag name if it doesn’t happen by 5.8-beta.This PR does not currently attempt to error on
require
calls of async modules (those with top-levelawait
). We do not emit any special marker in declaration files indicating the presence of TLA, which is a prerequisite. My suspicion is that the sentiment will be that a static check for async modules in therequire
graph is not worth the pain of making a backward-incompatible declaration file change.The other change in this PR is that import assertions are now prohibited in
--module nodenext
, since Node.js v22+ does not parse them. Since there have been a lot of module target changes in fast succession, here’s the summary:5.6
target
moduleResolution
es2022
node16
esnext
nodenext
5.7.3
target
moduleResolution
es2022
node16
esnext
nodenext
type "json"
5.8
target
moduleResolution
es2022
node16
es2022
node16
type "json"
es2023
node16
type "json"
esnext
nodenext
type "json"