swc-project / swc-project/swc-node
Version "1.10.9" gives error "Failed to deserialize buffer as swc::config::Options"
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 2k
- Forks
- 95
- Avg merge
- 14d 11h
- Merged PRs (30d)
- 1
Description
With Node v20.15.1, "@swc-node/register" worked fine with v1.9.1, but gives the following error on 1.10.9:
...i/node_modules/.pnpm/@swc+core@1.3.41/node_modules/@swc/core/index.js:241
return bindings.transformSync(isModule ? JSON.stringify(src) : src, isModule, toBuffer(newOptions));
Error: Failed to deserialize buffer as swc::config::Options
If it helps, here's our .swcrc:
[
{
"$schema": "https://json.schemastore.org/swcrc",
"env": {
"targets": {
"node": "20.15.1"
}
},
"test": ".*.(ts|js)$",
"jsc": {
"target": "es2021",
"externalHelpers": false,
"parser": {
"syntax": "typescript",
"decorators": true,
"dynamicImport": true
},
"keepClassNames": true,
"loose": true,
"transform": {
"legacyDecorator": false,
"decoratorMetadata": true
}
},
"module": {
"type": "commonjs"
},
"sourceMaps": "inline"
},
{
"test": ".*.json$",
"jsc": {
"transform": {
"optimizer": {
"jsonify": {
"minCost": 0
}
}
}
}
}
]
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the failure with Node v20.15.1 and the supplied .swcrc, starting at @swc/core/index.js line 241 and comparing @swc-node/register versions 1.9.1 and 1.10.9. Trace which configuration causes deserialization to fail, then verify the issue is resolved without breaking the shown TypeScript, decorator, CommonJS, and JSON cases.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- node.js, typescript
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100