Can I have VSCode kick off my app using NPM run scripts and then attach to the resulting process to debug?
My project kicks off with nodemon via NPM script (to execute babel, etc). However, while the app kicks off, VSCode's debugger doesn't attach (breakpoints are skipped).
// from package.json
"scripts": { "debug": "nodemon --inspect --exec babel-node src/app.js" }
// from launch.json
{
"type": "node",
"request": "launch",
"name": "Debug",
"runtimeExecutable": "npm",
"runtimeArgs": [
"run-script",
"debug"
],
"address": "localhost",
"port": 9229,
"protocol": "auto",
"restart": true,
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen",
"autoAttachChildProcesses": true
}
It seems the debugger starts but breakpoints I placed next to a few test calls are ignored. Here's the terminal output:
[nodemon] 1.19.1
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: *.*
[nodemon] starting `babel-node --inspect src/app.js`
Debugger listening on ws://127.0.0.1:9229/13ef6ca8-40da-4741-854a-467e4230b2a7
For help, see: https://nodejs.org/en/docs/inspector
Debugger attached.
Hey!
Waiting for the debugger to disconnect...
[nodemon] clean exit - waiting for changes before restart```
Looks like this was a fool's errand because it technically can't be done.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With