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

[@swc-node/register] - Request to add support for es2023 and es2024 targets #904

Open
shawnmcknight opened this issue Feb 18, 2025 · 0 comments

Comments

@shawnmcknight
Copy link

shawnmcknight commented Feb 18, 2025

In swc-project/swc#9700, support was added to swc for targets es2023 and es2024. swc-node/register does not appear to support those targets:

function toTsTarget(target: ts.ScriptTarget): Options['target'] {
switch (target) {
case ts.ScriptTarget.ES3:
return 'es3'
case ts.ScriptTarget.ES5:
return 'es5'
case ts.ScriptTarget.ES2015:
return 'es2015'
case ts.ScriptTarget.ES2016:
return 'es2016'
case ts.ScriptTarget.ES2017:
return 'es2017'
case ts.ScriptTarget.ES2018:
return 'es2018'
case ts.ScriptTarget.ES2019:
return 'es2019'
case ts.ScriptTarget.ES2020:
return 'es2020'
case ts.ScriptTarget.ES2021:
return 'es2021'
case ts.ScriptTarget.ES2022:
case ts.ScriptTarget.ESNext:
case ts.ScriptTarget.Latest:
return 'es2022'
case ts.ScriptTarget.JSON:
return 'es5'
}

It appears that if a target of es2023 or es2024 is used in the tsconfig then the toTsTarget function will return undefined which then will cause the swc transformation to revert to its default which appears to be es5.

This issue is a request to add support for tsconfig targets of es2023 and es2024 to match that of swc.

Thanks!

@shawnmcknight shawnmcknight changed the title Add support for es2023 and es2024 targets [@swc-node/register] - Request to add support for es2023 and es2024 targets Feb 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant