简体   繁体   中英

Simple nodemon.json config to watch all except for certain files

nodemon.json :

{
  "verbose": true,
  "ignore": [
    ".git",
    "node_modules",
    "*.marko.js"
  ],
  "watch": [
    "**/*"
  ]
}

I'd like for nodemon to watch every file in every directory except for those which I specifically set to ignore.

The above config isn't doing it:

[nodemon] files triggering change check: src/template.marko
[nodemon] matched rule: **/src/**/*
[nodemon] changes after filters (before/after): 1/0

It doesn't restart.

I had the same issue earlier, it seems the nodemon.json doesn't do the thing, so try to do it in an inline commnad :

nodemon --ignore '.git'

(you can put this as a npm script as well)

You may want to consider using browser-refresh . It's not a drop-in replacement for nodemon but it does a lot of the same things. browser-refresh watches everything and you can configure what you don't want to watch using a .browser-refresh-ignore file that is in the same format as .gitignore .

Internally, browser-refresh uses ignoring-watcher

尝试这个:

"ignoreRoot": [".git", ...],

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM