Skip to content

Support ES2023 and ES2024 targets when using SWC #2160

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

Open
felipeplets opened this issue May 1, 2025 · 1 comment · May be fixed by #2161
Open

Support ES2023 and ES2024 targets when using SWC #2160

felipeplets opened this issue May 1, 2025 · 1 comment · May be fixed by #2161

Comments

@felipeplets
Copy link

Search Terms

  • swc
  • ES2024
  • ES2023

Expected Behavior

  • SWC since version 1.8.0 (2024-11-04) supports ES2023 and ES2024
  • Once using ts-node with swc having a target equals to ES2023 or ES2024 the application should execute correctly

Actual Behavior

  • The application fails with error:
return bindings.transformSync(isModule ? JSON.stringify(src) : src, isModule, toBuffer(newOptions));
                ^
Error:   x jsc.target should be es5 or upper to use getter / setter

Steps to reproduce the problem

In a project using ts-node with swc set the target to ES2023 or ES2024 and it will fail. Once you set the target as ES2022 the project work as expected.

Minimal reproduction

Same as above

Specifications

  • ts-node version: 10.9.2
  • node version: 22.15.0
  • TypeScript version: 5.8.3
  • tsconfig.json, if you're using one:
{}
  • package.json:
{}
  • Operating system and version:
  • If Windows, are you using WSL or WSL2?:
@felipeplets
Copy link
Author

felipeplets commented May 1, 2025

@cspotcode I've opened a PR resolving this issue, but I would also like to propose that instead of automatically downgrading the target to ES3 in this line we should raise an exception letting the user know that the specified target is not currently supported.

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 a pull request may close this issue.

1 participant