Search code examples
nodemon

Nodemon - exclusion of files


I would like to exclude some specific files from monitoring of NodeMon. How can I do this?

My existing configuration:

nodemon: {
      all: {
        script: 'app.js',
        options: {
          watchedExtensions: ['js']
        }
      }

Solution

  • In order to make NodeMon ignore a bunch of files from monitoring, you can start it as

    nodemon --ignore PATTERN [--ignore PATTERN2]
    

    where PATTERN is the name of a specific file, directory, or wildcard pattern. Make sure that if you use a wildcard, it is escaped.

    For example

    nodemon --ignore 'lib/*.js' --ignore README
    

    Alternatively, if you want to configure that behaviour instead, try creating a nodemon.json file in your current working directory, or your home directory. You can configure ignoring some files by adding something like the following to this config file:

    {   
        "ignore": ["lib/*.js", "README"] 
    }
    

    Refer the README file at https://github.com/remy/nodemon for more details.