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!
In swc-project/swc#9700, support was added to swc for targets
es2023andes2024.swc-node/registerdoes not appear to support those targets:swc-node/packages/register/read-default-tsconfig.ts
Lines 56 to 82 in 6cdcf2c
It appears that if a target of
es2023ores2024is used in the tsconfig then thetoTsTargetfunction will returnundefinedwhich then will cause the swc transformation to revert to its default which appears to bees5.This issue is a request to add support for tsconfig targets of
es2023andes2024to match that of swc.Thanks!