-
-
Notifications
You must be signed in to change notification settings - Fork 376
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
fix: memory leak when writeToDisk
used
#472
Conversation
@@ -15,6 +15,10 @@ module.exports = { | |||
|
|||
for (const compiler of compilers) { | |||
compiler.hooks.emit.tap('WebpackDevMiddleware', (compilation) => { | |||
if (compiler.hasWebpackDevMiddlewareAssetEmittedCallback) { |
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.
Ugly name, but we guarantee what we don't intersect with something
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.
Also in webpack@5 assetEmitted
hook has compilation
in arguments so we simplify this code in near future
Codecov Report
@@ Coverage Diff @@
## master #472 +/- ##
==========================================
+ Coverage 97.35% 97.37% +0.02%
==========================================
Files 7 7
Lines 302 305 +3
Branches 100 101 +1
==========================================
+ Hits 294 297 +3
Misses 8 8
Continue to review full report at Codecov.
|
836d57d
to
a9bb60a
Compare
@hiroppy feel free to feedback |
@@ -74,6 +78,7 @@ module.exports = { | |||
}); | |||
} | |||
); | |||
compiler.hasWebpackDevMiddlewareAssetEmittedCallback = true; |
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.
We don't actually need to create a flag for the compiler
. e.g.
let hasWebpackDevMiddlewareAssetEmitted = false;
compiler.hooks.emit.tap('WebpackDevMiddleware', (compilation) => {
// ...
hasWebpackDevMiddlewareAssetEmitted = true;
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.
@unbug developers can add new compiler in runtime
This PR contains a:
Motivation / Use-Case
fixes #469
Breaking Changes
No
Additional Info
Need refactor test, let's do it in future
Need fix compatibility with webpack@5, i will do it in next PR