swc-project / swc-node

Faster ts-node without typecheck
MIT License
1.72k stars 71 forks source link

Documentation missing on how to setup vscode debugger #674

Closed bastien-m closed 1 year ago

bastien-m commented 1 year ago

I'm trying to configure vscode debugger to work with swc-node and I can't find any documentation on how to setup that, Am I missing something?

I start my project using the following command line node -r @swc-node/register src/index.ts and I set my launch.json with this content

{
      "type": "node",
      "name": "Debug back server",
      "request": "launch",
      "cwd": "${workspaceFolder}/back",
      "runtimeExecutable": "node",
      "args": ["-r", "@swc-node/register", "src/index.ts"],
      "envFile": "back/.env",
      "console": "integratedTerminal",
      "internalConsoleOptions": "neverOpen",
      "env": {
        "NODE_ENV": "development"
      }
    },

It start my project properly but can't reach my breakpoint, since I guess the link between the source code and node is not set properly. Do you have any idea ?

Sorry to post an issue for that, I can't find any other way to ask this.

mikaoelitiana commented 1 year ago

@bastien-m I had the same issue, I fixed it by adding "inlineSourceMap": true, inside compilerOptions of my tsconfig.json

bastien-m commented 1 year ago

@mikaoelitiana thx indeed it works ;) Maybe it could be put inside the documentation.