According to the documentation, it is possible to launch a program before debugging:
To launch a task before the start of each debug session, set the
For version 2.0.0 configuration you now use label
instead of taskName
.
package.json:
...
"scripts": {
"tsc": "tsc",
...
}
...
launch.json (My source is in the src
directory and tsc
compiles to the dist
directory):
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"preLaunchTask": "Compile",
"name": "Launch Program",
"program": "${workspaceFolder}/src/index.ts",
"outFiles": [
"${workspaceFolder}/dist/**/*.js"
],
"protocol": "inspector",
"sourceMaps": true
}
]
}
tasks.json:
{
"version": "2.0.0",
"tasks": [
{
"label": "Compile",
"type": "npm",
"script": "tsc",
"problemMatcher": []
}
]
}