How to debug child Node.JS process in VS Code?
Here is the example of the code that I'm trying to debug:
var spawn = require('child_process').spawn;
var scriptPath = './child-script.js';
var runner_ = spawn('node', [scriptPath]);
In your launch configuration add "autoAttachChildProcesses": true
like shown below
{
"type": "node",
"request": "launch",
"name": "Launch Program",
"autoAttachChildProcesses": true,
"program": "${workspaceFolder}/index.js"
}