K
K
Konstantin2020-03-26 15:43:49
typescript
Konstantin, 2020-03-26 15:43:49

How to debug ts files in VSCODE (Node)?

Now this is the debugger config (it is not working for TS, as you can see for node):

{
    "version": "0.2.0",
    "configurations": [

        {
            "type": "node",
            "request": "launch",
            "name": "Launch Program",
            "skipFiles": [
                "<node_internals>/**"
            ],
            "program": "${workspaceFolder}\\build\\index.ts",
            "outFiles": ["${workspaceFolder}\\build\\index.js"]
        }
    ]
}


If I understand correctly, you cannot directly debug ts - you need to convert files to js.

How then in the workspace to set breakpoints in ts files

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Shvets, 2020-03-26
@Junart1

Konstantin , yes, there are plenty of manuals.
Starting from the official https://code.visualstudio.com/docs/typescript/type...
To custom https://medium.com/@PhilippKief/how-to-debug-types...
In general, there is one thing. It is necessary to compile first, then run the debug. The main thing is that "sourceMap": true should be.
And you can immediately debug using ts-node
https://gist.github.com/cecilemuller/2963155d0f249...
https://medium.com/@dupski/debug-typescript-in-vs-...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question