Skip to content
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

fix: revert exports syntax change #180

Merged
merged 1 commit into from
Jun 4, 2023

Conversation

bjornstar
Copy link
Contributor

Resolves #179

The exports syntax that was used in v5.4.0 only works in node v20+

Reverting it back to the previous syntax fixes the problem, but I tried to test it with node v20 and ran into an error:

npx ts-node-esm ./index.ts
TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".ts" for /Users/bjornstar/test/index.ts

This seems to be an issue with ts-node in node v20 - TypeStrong/ts-node#1997
With a WIP PR from isaacs - TypeStrong/ts-node#2009

In the meantime there is a workaround to use the ts-node/esm loader directly:

node --no-warnings=ExperimentalWarning --loader ts-node/esm ./index.ts

It would be nice if we could unblock existing node v16 / v18 users until ts-node is fixed on node v20.

@sindresorhus
Copy link
Owner

The exports syntax that was used in v5.4.0 only works in node v20+

This is incorrect. That syntax has worked since Node.js v12. The problem here is TypeScript.

@sindresorhus
Copy link
Owner

I will revert it for now. But it will come back in the next major version.

@sindresorhus sindresorhus merged commit d1574d3 into sindresorhus:main Jun 4, 2023
@bjornstar bjornstar deleted the fix/revert-exports branch June 4, 2023 13:37
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.

v5.4.0 "Cannot find module '@sindresorhus/is' or its corresponding type declarations"
2 participants