I'm trying to debug a NodeJS app and its related typescript packages linked with npm link
.
Structure looks like this:
/root/package-a # typescript package
/root/package-b # another typescript package
/root/app # NodeJS application
I have linked the packages to the app as such:
npm link
inside each packagenpm link package-a package-b
in the app
And then in /root/app/.vscode/launch.json
I have:
"runtimeArgs": ["--preserve-symlinks"],
"outFiles": [
"${workspaceFolder}/build/**/*.js",
"${workspaceFolder}/../package-a/build/**/*.js",
"${workspaceFolder}/../package-b/build/**/*.js",
]
This all works very well when it comes to building each package and the app with npm run tsc
. Also in watch mode, changes are correctly propagated from packages to app. However when I try to set a breakpoint in VS Code inside any of the packages, the debugger can't find the related TS source. The breakpoint stays grey :-(
Also: I've setup each tsconfig.json
with "sourceMap": true
, so there are .js.map
files next to each built files in the app and in the packages.
How to correctly set this up so that the breakpoint in packages turn red ?