webpack / watchpack

Wrapper library for directory and file watching.
MIT License
377 stars 105 forks source link

Webpack watch stops if one of the output files is busy #223

Open Banner-Keith opened 2 years ago

Banner-Keith commented 2 years ago

This is the same issue reported in #44

When in watch mode, if a file is busy when attempting to emit to it, watch stops functioning.

[webpack-cli] [Error: EBUSY: resource busy or locked, open '{filepath here}'] { errno: -4082, code: 'EBUSY', syscall: 'open', path: '{filepath here}' }

Steps to reproduce. run webpack --watch save a watched file output to a file which is currently being used by another process

Most file watchers will try again rather than just shutting down.

In our case I believe that our security software is causing the issue as they are constantly scanning various files. This is not something we can really disable so we just have to retry the watch manually which is a huge pain.

I'd be happy to open a PR with retry logic if you guys are interested. If you have an idea of approximately where in the code that should be handled that would save me some time, but I can dig through it and figure it out if necessary.

Windows 10 node version: 16.15.1 npm version: 8.13.2 webpack version: 5.74.0

alexander-akait commented 2 years ago

Sounds resonable, but I think it is better to create an option to skip these errors/problems (maybe even with busy: bool | number), false disable reporting, true - current behaviour, number - count of retries, what do you think?

Banner-Keith commented 2 years ago

That sounds reasonable to me. Any of those options would be enough to get me past my issue.

alexander-akait commented 2 years ago

Feel free to send a PR :+1: