Node + ExpressJS debugging on VS Code is not watching for changes
I have a Node
+ ExpressJS
backend test server which I run (and watch for changes) with the following command:
$ npm run dev
That’s because I have the following: package.json
:
{
...
"main": "index.js",
"type": "module",
"scripts": {
...
"dev": "cross-env DEBUG=app nodemon --exec babel-node src/index.js"
},
...
}
I also can debug the backend code with VS Code
by using this: /.vscode/launch.json
:
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Backend Debug",
"type": "node",
"request": "launch",
"program": "${workspaceFolder}/backend/src/index.js",
"runtimeExecutable": "${workspaceFolder}/backend/node_modules/.bin/babel-node",
"runtimeArgs": ["--nolazy"]
}
]
}
My problem is: Even though I can properly debug the backend code with the launch.json
above, the process is not watching for changes. I mean, if I do a change on the code then the server doesn’t restart with new changes.
Any idea on how to do this?
Thanks!