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

The latest version of @swc/core has made a break change, resulting in ts-node reporting an error. #2059

Closed
atorber opened this issue Sep 12, 2023 · 6 comments · Fixed by #2062 · May be fixed by #2104
Closed

The latest version of @swc/core has made a break change, resulting in ts-node reporting an error. #2059

atorber opened this issue Sep 12, 2023 · 6 comments · Fixed by #2062 · May be fixed by #2104

Comments

@atorber
Copy link

atorber commented Sep 12, 2023

"ts-node": "^10.9.1"

"@swc/core": "^1.3.78" is ok,but subsequent versions will report errors.

The peerDependencies declaration in the ts node/package.json file will cause the installation of the latest dependent package instead of the specified one.

"peerDependencies": {
"@swc/core": ">=1.2.50",
"@swc/wasm": ">=1.2.50",
"@types/node": "*",
"typescript": ">=4.2"
}

@atorber
Copy link
Author

atorber commented Sep 12, 2023

An example of running an error message : atorber/chatflow#40

@MuTsunTsai
Copy link

I think this is the same as #2056.

@thetutlage
Copy link
Contributor

thetutlage commented Sep 14, 2023

node:internal/process/esm_loader:46
      internalBinding('errors').triggerUncaughtException(
                                ^
Error: @swc/core threw an error when attempting to validate swc compiler options.
You may be using an old version of swc which does not support the options used by ts-node.
Try upgrading to the latest version of swc.
Error message from swc:
Failed to deserialize buffer as swc::config::Options
JSON: {"sourceMaps":true,"module":{"noInterop":false,"type":"commonjs","strictMode":true,"ignoreDynamic":false},"swcrc":false,"jsc":{"parser":{"syntax":"typescript","tsx":false,"decorators":true,"dynamicImport":true,"importAssertions":true},"target":"es2022","transform":{"decoratorMetadata":true,"legacyDecorator":true,"react":{"throwIfNamespace":false,"useBuiltins":false}},"keepClassNames":true,"experimental":{"keepImportAssertions":true}}}

Caused by:
    unknown field `keepImportAssertions`, expected one of `plugins`, `keepImportAttributes`, `emitAssertForImportAttributes`, `cacheRoot`, `disableBuiltinTransformsForInternalTesting` at line 1 column 438
    at createVariant (/Users/virk/app/node_modules/ts-node/src/transpilers/swc.ts:262:13)
    at createSwcOptions (/Users/virk/app/node_modules/ts-node/src/transpilers/swc.ts:211:25)
    at create (/Users/virk/app/node_modules/ts-node/src/transpilers/swc.ts:56:41)
    at createTranspiler (/Users/virk/app/node_modules/ts-node/src/index.ts:784:16)
    at createTranspileOnlyGetOutputFunction (/Users/virk/app/node_modules/ts-node/src/index.ts:1341:28)
    at createFromPreloadedConfig (/Users/virk/app/node_modules/ts-node/src/index.ts:1404:34)
    at create (/Users/virk/app/node_modules/ts-node/src/index.ts:624:10)
    at register (/Users/virk/app/node_modules/ts-node/src/index.ts:591:15)
    at Object.registerAndCreateEsmHooks (/Users/virk/app/node_modules/ts-node/src/esm.ts:116:34)
    at file:///Users/virk/app/node_modules/ts-node/esm.mjs:8:7

Here's the error

@SalvatorePreviti
Copy link

Is there any release date planned soon? SWC new version is 1.3.100 and I had to lock the version to 1.3.82 because this is not still released

@MuTsunTsai
Copy link

@SalvatorePreviti
Somewhere around SWC 1.3.96 the issue was gone for me, and I no longer need to lock to 1.3.82.

@SalvatorePreviti
Copy link

@SalvatorePreviti Somewhere around SWC 1.3.96 the issue was gone for me, and I no longer need to lock to 1.3.82.

Thank you, you are right, it works

smcenlly added a commit to smcenlly/ts-node that referenced this issue Jan 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants