fix: add writeToDisk support for clean: true#1472
fix: add writeToDisk support for clean: true#1472Mortaro wants to merge 1 commit intowebpack:mainfrom
Conversation
|
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1472 +/- ##
==========================================
+ Coverage 97.34% 97.39% +0.04%
==========================================
Files 9 9
Lines 377 384 +7
Branches 112 114 +2
==========================================
+ Hits 367 374 +7
Misses 9 9
Partials 1 1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| /** @type {String} */ originalPath, | ||
| /** @type {(arg0?: null | NodeJS.ErrnoException) => void} */ originalCallback | ||
| ) => { | ||
| fs.unlink(originalPath, () => {}); |
There was a problem hiding this comment.
Hello, there is racing you should wait the first operation finished, also using fs.unlink is not safe, because some developer use custom outputFileSystem to avoid file removing, but we remove them and break application, we nee to think deeply how we can handle such case. In theiry we can apply clean plugin before watch and it will with original fs
|
Add write disk support for clean true |
|
Closing due to inactivity. |
|
Add clean disk |
This PR contains a:
Motivation / Use-Case
I'm the author of Nullstack, one of its build modes targets chrome extensions.
I use the writeToDisk option in development mode to preview the extensions with HMR, but the middleware was never cleaning up the real FS when MemFS unlinked files, causing the output folder to become bloated over time.
Breaking Changes
There are no breaking changes.
Additional Info
The solution I added might be a bit hacky, but it does solve this issue that has been open for a minute: #861
I have temporarily moved the unstable branch of Nullstack to use my fork, but would love to have this fix merged so i can rollback to the official package 💜