Most node.js developers use Nodemon as a development server, as it allows you to watch your project files and will automatically restart Node when changes are detected. However, there are a few problems with this. Restarting an application every time a file changes is often unnecessary, and causes a slight delay before you can refresh your page (as database connections are restored and such).
Luckily, we can add a file called .nodemonignore in our project folder, which will tell Nodemon to ignore changes to specific files and folders. Here’s a sample file:
/node_modules/* /public/* /views/* /.git/* /.gitignore /package.json /Profile /README.md
In general, it’s pretty safe to ignore your template folder and static asset directory, as well as the git directory (no point in restarting your node server whenever you git commit). I opt to ignore my node_modules folder as well, so there are less files to watch (I was going over the max limit for my OS).
It appears `.nodemonignore` is now deprecated. According to the most recent docs:
nodemon can also be configured via a local and global config file:
* $HOME/nodemon.json
* $PWD/nodemon.json OR –config
* nodemonConfig in package.json
I added this to my package.json and it works:
“nodemonConfig”: {
“ignore”: [
“dist/*”,
“src/*”,
“package.json”
]
}
Also, “.git” and “.node_modules” are now ignored by default: https://github.com/remy/nodemon/blob/master/faq.md#overriding-the-underlying-default-ignore-rules
[…] nodemon readme #ignoring files This is a good post on which take .nodemonignore further on […]