'Nodemon - specifying extension watch list using config files

Is there a way to specify watch list using config files instead of command line?


Command line method in nodemon's doc:

nodemon github


I attempted to use a nodemon.json config file with the following:

{ 
"ext": ["js", "json", "hbs", "html"]
}

Returned an 'extension.match' error.

Then I tried to add the config to package.json with the below:

{...
"nodemonConfig": {
    "ext": ["js", "json", "hbs", "html"]
  }
...}

Also same error.

I have a feeling both approaches are on the right track, but I'm missing something.



Solution 1:[1]

You can use a nodemon.json file in the root of your application you were almost there but the syntax is slightly different to what you had the correct syntax would look like this:

{
    "ext": "js,json,hbs,html"
}

Solution 2:[2]

Step 1: First you add nodemon.json file in the root of your project. (For example if you have a Weather-App Project first you add nodemon.json in the root.)

      Weather-App _
                   |_ nodemon.json

Step 2: Add this code in newly created nodemon.json file.

        {
          "ext": "js,json,hbs,html,css"
        }   

Solution 3:[3]

Nodemon also supports using package.json for configuration, under nodemonConfig key.

The config is in the same format as in the nodemon.json config file:

package.json

{
  ...
  "nodemonConfig": {
    "ext": "js,json,hbs,html",
    ...
  }
}

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 futurelucas4502
Solution 2
Solution 3 andreivictor