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

WASM SWC errors only in debug mode #23526

Open
TreetopFlyer opened this issue Apr 24, 2024 · 1 comment
Open

WASM SWC errors only in debug mode #23526

TreetopFlyer opened this issue Apr 24, 2024 · 1 comment
Labels
bug Something isn't working inspector related to the inspector integration

Comments

@TreetopFlyer
Copy link

Version: Deno 1.42.3

The following initializes the wasm version of swc.rc:
example.ts

import init from "https://esm.sh/@swc/wasm-web";
await init();

You can deno run example.ts without issue, however when in debug mode (--inspect-wait or --inspect-brk), and after a debugger gets attached, it errors with:

error: Uncaught (in promise) TypeError: WebAssembly.compile(): Argument 0 must be a buffer source
    at eventLoopTick (ext:core/01_core.js:168:7)
Process exited with code 1

It's possible that this is specific to SWC, but it is interesting to note that Deno itself has to be in debug mode for it to happen so just mentioning it here, thank you.

@marvinhagemeister marvinhagemeister added bug Something isn't working inspector related to the inspector integration labels Apr 24, 2024
@TreetopFlyer
Copy link
Author

TreetopFlyer commented Apr 24, 2024

Just an a side note if the problem is in the WASM code (please delete if its not helpful): Another way of looking at this issue is that we're ultimately trying to jury-rig a transpiler here. Instead, if Deno (and Deploy) had some way of just exposing its own internal SWC transpiler so you don't have to add one "again" to your project e.g.

const esmDevString = await Deno.swc(`export default (props:{title:string})=><h1>{props.title}</h1>;`, {
    sourceMaps: "inline",
    jsc:{
        parser: { syntax: "typescript", tsx: true},
        transform: { react: { runtime: "automatic" } }
    }
});

it could benefit anyone working with isomorphic javascript.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working inspector related to the inspector integration
Projects
None yet
Development

No branches or pull requests

2 participants