This example will show you how to activate breakpoint in .ts
file.
Adding breakpoint is crucial for debugging your program.
You need to add and configure launch.json
and tasks.json
.
launch.json
needs to be set so that debugger can read the source maps. It needs to have sourceMaps
field to be set to true
.
tasks.json
needs to be set to run tsc
before the debugger is running.
-
Clone this repo.
-
Install typescript:
npm install -g typescript
. -
Go to Debug section on the VSCode (Shift+Cmd D).
-
Add breakpoint in
src/index.ts
. -
Run the
Debug Typescript in Node.js
config. -
See breakpoint in action.
Kudos to jyuhuan for the nice example.
MIT License.