Stop Nodemon from restarting when a specific file is updated?

coderguy asked this question 9 months ago
coderguy on Jun 24, 2022

In my Node.js application, I use Nodemon to automatically restart my application when I make a code change.

But I have a specific JSON file that gets updated that I don't want the application to restart for.

How can I configure Nodemon to ignore that file?

2 suggested answers
looper003 on Jun 24, 2022

Nodemon has an --ignore flag you can add to the nodemon command.

Ignore a file:

nodemon ignore lib/data.json

You can also do a pattern to ignore changes in all json files:

nodemon --ignore '*.json'
0 replies
yaboy01 on Jun 24, 2022

Check out their documentation:

You can simply add a --ignore flag to it:

nodemon --ignore lib/app.js
0 replies