Skip to content

feat: set module: nodenext for node bases >=20 #301

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

Merged
merged 1 commit into from
Mar 23, 2025
Merged

Conversation

danielpza
Copy link
Contributor

@danielpza danielpza commented Mar 19, 2025

Closes #279

Set module: nodenext for node bases >= 20 (node20, node21, node22, node23 bases) per typescript 5.8 recommendations

This adds support to require(esm) feature supported in node 22 and more recently node 20

TypeScript 5.8 supports this behavior under the --module nodenext flag. When --module nodenext is enabled, TypeScript will avoid issuing errors on these require() calls to ESM files.

Because this feature may be back-ported to older versions of Node.js, there is currently no stable --module nodeXXXX option that enables this behavior; however, we predict future versions of TypeScript may be able to stabilize the feature under node20. In the meantime, we encourage users of Node.js 22 and newer to use --module nodenext, while library authors and users of older Node.js versions should remain on --module node16 (or make the minor update to --module node18).

@danielpza danielpza changed the title feat: set module=nodenext for >=node20 bases feat: set module: nodenext for node bases >=20 Mar 19, 2025
@orta
Copy link
Member

orta commented Mar 23, 2025

I agree with the comments in #279 👍🏻

@orta orta merged commit aa6f7d1 into tsconfig:main Mar 23, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

@tsconfig/node22/tsconfig.json uses the wrong module and moduleResolution!?!
2 participants