Closed DawitAskabe closed 9 months ago
This is not a bug, chokidar is not content aware!
What you need is a debounce function if you have trigger happy fingers (Lodash provides _.debounce
if you don't want to write your own).
How the chokidar works under the hood:
Every time you press Cmd + S, the file is written to, and thus it is "changed" as far as the filesystem is concerned. chokidar
listens for filesystem level change
events that are emitted, not check the actual content of the file to see if it has "changed" in the literal sense.
yah i figured. I didnt think about using debounce. will give it a try.
Describe the bug Out of habit i press command+S (save) more than once when i save a file. Chokidar triggers build for each save regardless the file content changed or not. I expected only one Change event to be triggered - the first one.
Versions (please complete the following information):
To Reproduce:
Steps to reproduce the behavior. Include filename and chokidar config.
Expected behavior should run build only once
Additional context I am not sure if its the OS that is we writing the file regardless change or not. is there a way to delay the trigger of the change event?