Skip to content

Watch is detecting the same file twice on minimal example #243

Open
@dman777

Description

Using Windows 7:

$ gulp --version
[14:00:20] CLI version 3.9.1
[14:00:20] Local version 3.9.1

gulp.watch is catching the same file change twice. I used to separate editors(vi and notepad) to make sure it was not the editor saving the file twice. I also tried debounceDelay and interval with on success to rid the the problem:

$ gulp watch
[13:57:27] Using gulpfile C:\git\global-spredfast-world-wall\gulpfile.js
[13:57:27] Starting 'watch'...
[13:57:27] Finished 'watch' after 8.44 ms
{ type: 'changed',
  path: 'C:\\git\\global-spredfast-world-wall\\index.html' }
{ type: 'changed',
  path: 'C:\\git\\global-spredfast-world-wall\\index.html' }
const gulp = require('gulp');
var browserSync = require('browser-sync').create();


gulp.task('serve', ['watch', 'browserSync']);
gulp.task('watch', watch);

function reloadBrowserSync(done) {
  console.log(done)
  browserSync.reload();
}

gulp.task('browserSync', function() {
    browserSync.init({
        server: {
            baseDir: "./"
        }
    });
});

function watch() {
  gulp.watch([
    'index.html'
  ], function(event){ console.log(event)});
}

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions