'VS Code autorestart debug with ts-node-dev

In my project I'm using ts-node-dev to run our code. So I have a task like this:

"start:debug": "env-cmd ts-node-dev --inspect --respawn --transpile-only server.js"

And my launch.json I have this:

{
  "version": "0.2.0",
  "configurations": [
    {
      "type": "node",
      "request": "attach",
      "name": "Typescript Server",
      "protocol": "inspector",
      "port": 9229,
      "restart": true,
    }
  ]
}

The thing is, when I save a file, ts-node-dev will restart the app with the new code, however I'm getting stuck with the Waiting for the debugger to disconnect...message, and it only restarts the app if I manually restart the debug process.

I tested theh same app in WebStorm and in this IDE, we have the option Restart Automaticallythat does what exactly what I expected (I save a file, and then, the debug restarts itself)

There's a way to make VS Code behave like WebStorm? I know that maybe I can use nodemon to to that, but I'm looking for a way to achieve this without it.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source