0

How to terminate an gulp.watch change event listener without terminating the rest of the gulp script?

Not an very elegant test case:

function paths() {
    var paths = JSON.parse(fs.readFileSync('../../z/paths.json'))
    gulp.watch(paths.scriptsFiles, ['test'])

    return paths
}
gulp.task('test', () =>
    gulp.src(paths().scriptsFiles)
        .pipe(...)
        .pipe(...)
)

Which leads to this error:

MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 change listeners added. Use emitter.setMaxListeners() to increase limit

Bram z
  • 735
  • 2
  • 7
  • 20

1 Answers1

0

I stumbled upon chokidar which says to be the underlying package in gulp. It is also very well documented with code examples.

Bram z
  • 735
  • 2
  • 7
  • 20