-
-
Notifications
You must be signed in to change notification settings - Fork 376
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: add writeToDisk support for clean: true #1472
base: master
Are you sure you want to change the base?
Conversation
|
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## master #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
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
/** @type {String} */ originalPath, | ||
/** @type {(arg0?: null | NodeJS.ErrnoException) => void} */ originalCallback | ||
) => { | ||
fs.unlink(originalPath, () => {}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
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 💜