nodemon ignore directory

In the very likely circumstance that you're using nodemon in a configuration file, you can create a separate configuration entry for those files to be ignored. Bonus, a cleaner looking nodemon call, especially if files to ignore grows large.

For example, this package.json instructs nodemon to ignore directory test:

{
  "scripts": {
    "test": "jest",
    "start": "nodemon server.js"
  },
  "nodemonConfig": {
      "ignore": ["test/*"]
  }
}

Find the complete instructions for nodemon configuration file settings here.

As in the other answer, be sure to restart nodemon for the configuration changes to take effect.


Create nodemon.json in your project root that looks something like this:

{
  "ignore": ["db.json"]
}

This is an alternative to using package.json as seen in Andrew Philips answer

See docs


You need to replace .. with ., or just reference client/ directly, also you will need to remove the asterisk:

"devStart": "nodemon --ignore ./client/ --exec babel-node src/server.js"

Or

"devStart": "nodemon --ignore client/ --exec babel-node src/server.js"

According to nodemon docs this is how to ignore a directory via command line:

nodemon --ignore lib/ --ignore tests/

Also note that nodemon will only restart the node process, if you change the npm script you will need to kill the process and re-run npm run devStart