Nodemon Watch Option Broken

I am using gulp -nodemon

config contains only one file, server.js.

$.nodemon({
  script: 'config/server.js',
  watch: ['config/**/*.js']
})
.on('restart', function () {
  setTimeout(function () {
    $.livereload.changed();
   }, 1000);
 });

Conclusion:

[gulp] [nodemon] v1.2.1
[gulp] [nodemon] to restart at any time, enter `rs`
[gulp] [nodemon] watching: config/**/*.js
[gulp] [nodemon] starting `node config/server.js`
[gulp] [nodemon] watching 34,325 files - this might cause high cpu usage. To reduce use "--watch".

If I enable the ignore option, it fixes.

ignore: [
  'node_modules/**',
  'bower_components/**'
]

Why does nodemon scan everything, even when I tell it to only look at the configuration directory?

Also appears on the output that it only looks at the configuration directory [nodemon] watching: config/**/*.js

+4
source share
1 answer

This seems to be a bug with nodemon because I was able to reproduce it with a simple command nodemon

> nodemon --watch app server.js
[nodemon] v1.2.1
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: app/**/*
[nodemon] starting `node server.js`
[nodemon] watching 72,981 files - this might cause high cpu usage. To reduce use "--watch"

nodemon - , , node_modules, bower_components .sass_cache. ignore , PR. , .

> nodemon --watch app server.js
[nodemon] v1.2.1
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: app/**/*
[nodemon] starting `node server.js`

, nodemon , watched, , , . .

ignore , nodemon .

: # 46, # 366 # 32

+18

Source: https://habr.com/ru/post/1548660/


All Articles