glob-watcher icon indicating copy to clipboard operation
glob-watcher copied to clipboard

Watchers do not detect specific files

Open mvicens opened this issue 3 years ago • 4 comments

Taking this Gulp file:

const { watch } = require('gulp');

function css(cb) {
	cb();
}

function js(cb) {
	cb();
}

function defaultTask(cb) {
	watch('src/**/*.css', css);
	watch('src/scripts/index.js', js);
	cb();
}

exports.default = defaultTask;

And, starting from an empty folder src, ...

  1. Run Gulp command.
  2. Create a CSS file. :white_check_mark: It is detected correctly (a "Starting 'css'..." and the appropriate finalization appear in the console).
  3. Change the content of this file. :white_check_mark: Detected.
  4. So, put the specific JS file. :x: Nothing happens.
  5. Change its content. :x: Nothing.
  6. Rerun command (finish and start again).
  7. Change the CSS content. :white_check_mark: Detected.
  8. Change the JS content. :white_check_mark: Detected.

Why this behaviour (steps 4 & 5)? Is it a bug, right?

mvicens avatar Nov 26 '22 20:11 mvicens

This should be resolved in v5, but feel free to let me know if not and I'll reopen.

yocontra avatar Apr 06 '24 20:04 yocontra

It makes the same. 😢

mvicens avatar Apr 16 '24 18:04 mvicens

Seems like the issue is watching a specific file (not a glob) that doesn't exist yet, then when it does exist the change isn't being picked up.

yocontra avatar Apr 17 '24 19:04 yocontra

I edited my issue explanation message to clarify more. Please, check it over.

mvicens avatar Apr 18 '24 09:04 mvicens