Files created right before watching starts make watching go into a loop
See original GitHub issueI’ve noticed this strange behaviour where watcher loops for 10 seconds due to this code:
if(data) {
var ts = data[0] === data[1] ? data[0] + FS_ACCURENCY : data[0];
if(ts > startTime)
watcher.emit("change", data[1] + FS_ACCURENCY);
}
What I’m doing in my script is basically creating a file in a temporary directory /temp/entry.js, creating a webpack compiler and run compiler.watch(). Now for 10 seconds (which is the default value of FS_ACCURENCY) this is what’s happening:
- compilation succeeds
- Watching.prototype._done gets called
- recalling Watching.prototype.watch
- which immediately triggers a change event for the
/temp/entry.jsfile, because it’s < 10 seconds old - back to step 1
Any pointers on how to fix this would be helpful. For example, this could be fixed by modifying the above code to this, but I’d need to stare at this for longer to understand what this block of code is conceptually responsible for.
if(ts > startTime + FS_ACCURENCY) {
Issue Analytics
- State:
- Created 7 years ago
- Reactions:31
- Comments:58 (5 by maintainers)
Top Results From Across the Web
How to Loop a Video for Your Audience to Watch on Repeat
To loop your video, tap the “effects” button at the bottom left corner. Scroll through the options until you locate “time.” Select time...
Read more >How to Loop Videos on iPhone? - Wondershare Filmora
These looping videos are fascinating and fun to watch. A loop is a popular element in photography and especially music videos, the idea...
Read more >Open and play a file in QuickTime Player on Mac
Open the video or audio file you want to loop. · Choose View > Loop so a checkmark appears next to it. ·...
Read more >3 Ways to Create Amazing Seamless Video Loops in ...
When you loop a complete project, the aim is to finish the video with the same frame as the start of the video....
Read more >How to Loop a YouTube Video on Desktop and Mobile - InVideo
For quite some time, users resorted to various solutions, such as third-party tools, to play YouTube videos on repeat. It wasn't until YouTube ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

This issue also confused me for a while. finally I found a trick to fix it.
also a npm package is available https://github.com/yessky/webpack-mild-compile, it works with webpack v2/3/4.
For anyone else tearing out hair over this, backdating the relevant files by ten seconds is an awful hack but it worked for me:
Update - This fix stopped working for me at some point, but Yassky’s solution further down the page works great.