Debugging Complex TS Projects in VSCode
launch.json Config File
This page assumes a build config based on the one in Publishing Type Definitions with a src and a dist folder.
We can use npm link to link project1 to project2 and then we can add the dist folders from both projects to outFiles so that they are picked up by the vscode debugger.
We also want to make sure that sourceMaps is set to true so that the debugger picks up the source maps in the dist folders and maps them onto the corresponding src folders.
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch Program",
"program": "${workspaceFolder}/project1/dist/index.js",
"preLaunchTask": "Build All",
"outFiles": [
"${workspaceFolder}/project1/dist/**/*.js",
"${workspaceFolder}/project2/dist/**/*.js"
],
"sourceMaps": true,
"sourceMapRenames": true
}
]
}