Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

this.addWatchFile does not listen for new files added to a directory #3704

Closed
mjackson opened this issue Jul 29, 2020 · 4 comments
Closed

this.addWatchFile does not listen for new files added to a directory #3704

mjackson opened this issue Jul 29, 2020 · 4 comments

Comments

@mjackson
Copy link

Expected Behavior

I'm expecting a rebuild when a new file is added to a directory that was passed to this.addWatchFile.

Actual Behavior

New files do not trigger a rebuild.

@mjackson
Copy link
Author

I believe this may be fixed by listening for the add event (in addition to the change and unlink events) in the file watcher here, but I'm not familiar enough with the code to be sure. FWIW I cloned the repo and was going to fix the bug myself but I couldn't get all tests to pass locally.

@lukastaegert
Copy link
Member

On slow machines, some tests might run into timeouts. You can focus on specific tests by adding solo: true in _config.js files for directory based tests and of course describe.only or it.only for file based tests. I think for watch we still only have the latter, but this should at least give you the opportunity to see if you can get your new test to run. Last, you can add a long timeout to a an it or describe via adding a it('...', () => {...}).timeout(20000) or more

@tzachbon
Copy link

tzachbon commented Mar 1, 2022

I'm sorry to bring up the dead. We face a similar issue in a new feature we want to implement in our library (wix/stylable#2342), and I feel this PR (#3812) missed this place:

watcher.on('change', handleChange);

Maybe I don't understand the entire flow, but what's the difference between them? @lukastaegert

@lukastaegert
Copy link
Member

The PR is correct as there are two distinct set of events:

  • file watcher events: That is what the PR is listening for. They are created by chokidar.
  • Rollup watcher events: These are emitted by Rollup's watcher. Currently, the only emitted event on file additions/changes/removals is change:
    this.emitter.emitAndAwait('change', id, { event })

    However, the original event is passed as a parameter

But I believe with #4427, which is now released in Rollup v2.70.0, your problems are resolved?

In any case, I will close this issue now as it has been resolved via #3812 a long time ago.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants