It appears that VS Code will support npm scripts and other launch scenarios since the release from October 2016.
Below is an example as it was proposed on GitHub but has been adjusted to use --inspect-brk instead of the originally prposed --debug-brk option.
packages.json
"scripts": {
"debug": "node --nolazy --inspect-brk=5858 myProgram.js"
},
vscode launch config
{
"name": "Launch via NPM",
"type": "node",
"request": "launch",
"cwd": "${workspaceRoot}",
"runtimeExecutable": "npm",
"runtimeArgs": [
"run-script", "debug"
],
"port": 5858
}
More recent updates for Visual Studio Code as of Summer of 2022 show that there are various ways to set up debugging support with Node.js. These methods include auto attaching to either processes started from the VSCode Integrated Terminal or the JavaScript debug terminal, or by using the traditional launch config which is now extensively documented.