Source maps using transpiled variable name

53 Views Asked by At

After looking at a myriad of questions & answers:

As well as videos describing debugging TS in VSCode:

I still cannot find my answer. The breakpoints hit when I debug my program but the only local variable names I can access are the transpiled ones & not the originals.

enter image description here

The screenshot above shows the app.ts with a breakpoint on it as well as the transpiled app.js & the local variables available to me in debugging. As you can see, I would expect the variable cluster to be visible but I only have cluster_1 which I can access the default of but doesn't have the direct properties of isPrimary or isWorker (cluster module).

tsconfig.json

{
  "compilerOptions": {
    "target": "ES2020",
    "module": "NodeNext",
    "sourceMap": true,
    "outDir": "dist",
    "moduleResolution": "NodeNext"
  },
  "exclude": ["node_modules", "dist"],
  "include": ["src/**/*", "lib/**/*"]
}

launch.json (configuration)

{
    "name": "Launch Scalper",
    "cwd": "${workspaceFolder}/scalper",
    "program": "${workspaceFolder}/scalper/dist/src/app.js",
    "request": "launch",
    "skipFiles": [
        "<node_internals>/**"
    ],
    "type": "node",
    "runtimeArgs": [
        "--nolazy"
    ],
    "outFiles": [
        "${workspaceFolder}/scalper/dist/**/*.js"
    ],
    "sourceMaps": true
}

Node version: 18.18.2
Typescript version: 5.5.3
VSCode version: 1.85.0

I've been searching for hours & am really at a loss. I even looked at this thread but there doesn't seem to be a resolution apart from workarounds with webpack.

EDIT:

I've tried with ts-node so my configuration is now:

{
    "name": "Launch Scalper",
    "cwd": "${workspaceFolder}/scalper",
    "program": "${workspaceFolder}/scalper/src/app.ts",
    "request": "launch",
    "skipFiles": [
        "<node_internals>/**"
    ],
    "type": "node",
    "runtimeArgs": [
        "--nolazy",
        "-r",
        "ts-node/register"
    ],
    "sourceMaps": true,
}

I get the same where the breakpoint is still hit but the original variable name is not seen. Is this now a problem with the VSCode version?

0

There are 0 best solutions below