Skip to content

Commit

Permalink
fix: memory leak when writeToDisk used (#472)
Browse files Browse the repository at this point in the history
  • Loading branch information
evilebottnawi authored Sep 27, 2019
1 parent aec1bf7 commit 6730076
Show file tree
Hide file tree
Showing 4 changed files with 240 additions and 256 deletions.
5 changes: 5 additions & 0 deletions lib/fs.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ module.exports = {

for (const compiler of compilers) {
compiler.hooks.emit.tap('WebpackDevMiddleware', (compilation) => {
if (compiler.hasWebpackDevMiddlewareAssetEmittedCallback) {
return;
}

compiler.hooks.assetEmitted.tapAsync(
'WebpackDevMiddleware',
(file, content, callback) => {
Expand Down Expand Up @@ -74,6 +78,7 @@ module.exports = {
});
}
);
compiler.hasWebpackDevMiddlewareAssetEmittedCallback = true;
});
}
},
Expand Down
Loading

0 comments on commit 6730076

Please # to comment.