How to reload debugger on file change/save

Hi there, i'm using debugger for developing GraphQL Node JS Server (Typescript). Without debugger it restarts after file change by nodemon. How can i get debugger restarted after file change or save?

Here is my config:





0
5 comments

You can still use nodemon for restarting - why not?

1
Avatar
Permanently deleted user

How is it? Config above simply says "Run index.ts with Node.js in Typescript mode".What exactly i need to type and in which field?

0

The recommended way to debug it is using the Attach to a Node.js/Chrome debug configuration with the Reconnect Automatically option enabled, as described in https://www.jetbrains.com/help/webstorm/2018.3/running-and-debugging-node-js.html#node_debugging_overview, Debugging a Node.js application that uses nodemon

- create a nodemon-debug.json with exec set as follows:

"exec": "node --inspect-brk --require ts-node/register src/index.ts"

- create an npm script in your package.json to run nodemon with this config:

"nodemon:debug": "nodemon --config nodemon-debug.json"

- create Attach to a Node.js/Chrome debug configuration:


- run your npm script, then select configuration above and press Debug:

 

2
Avatar
Permanently deleted user

Yeah, it works! Thank you! Only one little problem:
Now i need run server by nodemon:debug command and then manualy run debugger. If i adding this nodemon:debug in "Before launch" menu it doesnt work, and i suppose because of there is no exit code thrown out of nodemon:debug comand. 

1

yes, exactly - the main process (debugger) is waiting for return code from a task added to 'before launch' to start. This is the way 'before launch' is designed - it's supposed to be used to run some sort of pre-processing before running the main process. 

0

Please sign in to leave a comment.