swc-project / swc-node

Faster ts-node without typecheck
MIT License
1.77k stars 73 forks source link

Version "1.10.9" gives error "Failed to deserialize buffer as swc::config::Options" #829

Open ab-geoff-plitt opened 1 month ago

ab-geoff-plitt commented 1 month ago

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
                    }
                }
            }
        }
    }
]
Brooooooklyn commented 1 month ago

@ab-geoff-plitt what's your @swc/core version?