The Ultimate VS Code Debug setup for Node.js

Narendra Sisodiya
1 min readApr 28, 2019

--

Recently I made a tweet about VSCode debug setup and many people asked how to do it.

The most important aspect that when we save the files, whole application re-start and debugger re-attach itself automatically. this is Super cool and super productive.

Ok, this is what you need to do it.

Step 1 — Create a VS Code setting file. “.vscode/settings.json”

This setting will turn on “Auto Attach”. You don’t need to create any launch.json. Auto Attach will do it automatically.

Step 2— Edit package.json and add the following line.

Nodemon will restart the server whenever there is a file change. When started with the “--inspect” switch, a Node.js process listens for a debugging client.

I wanted to use ES6 import statement, so Added ESM too. Visit https://github.com/standard-things/esm for more details.

with all these combinations, Its a super cool setup 😎

Yup, you need to do npm install too

Thanks.

--

--

Narendra Sisodiya
Narendra Sisodiya

Responses (1)