Skip to content

Support ES2023 and ES2024 targets when using SWC #2160

Open
@felipeplets

Description

@felipeplets

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?:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions