watchpack icon indicating copy to clipboard operation
watchpack copied to clipboard

Webpack watch stops if one of the output files is busy

Open Banner-Keith opened this issue 3 years ago • 3 comments

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

Banner-Keith avatar Aug 22 '22 16:08 Banner-Keith

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?

alexander-akait avatar Aug 29 '22 14:08 alexander-akait

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

Banner-Keith avatar Aug 29 '22 15:08 Banner-Keith

Feel free to send a PR :+1:

alexander-akait avatar Aug 29 '22 16:08 alexander-akait