Skip to content
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

Merged
merged 1 commit into from
Sep 27, 2019
Merged

fix: memory leak when writeToDisk used #472

merged 1 commit into from
Sep 27, 2019

Conversation

alexander-akait
Copy link
Member

@alexander-akait alexander-akait commented Sep 27, 2019

This PR contains a:

  • bugfix
  • new feature
  • code refactor
  • test update
  • typo fix
  • metadata update

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

@@ -15,6 +15,10 @@ module.exports = {

for (const compiler of compilers) {
compiler.hooks.emit.tap('WebpackDevMiddleware', (compilation) => {
if (compiler.hasWebpackDevMiddlewareAssetEmittedCallback) {
Copy link
Member Author

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

Copy link
Member Author

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
Copy link

codecov bot commented Sep 27, 2019

Codecov Report

Merging #472 into master will increase coverage by 0.02%.
The diff coverage is 100%.

Impacted file tree graph

@@            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
Impacted Files Coverage Δ
lib/fs.js 96.77% <100%> (+0.16%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update aec1bf7...a9bb60a. Read the comment docs.

@alexander-akait
Copy link
Member Author

@hiroppy feel free to feedback

@@ -74,6 +78,7 @@ module.exports = {
});
}
);
compiler.hasWebpackDevMiddlewareAssetEmittedCallback = true;
Copy link

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;

Copy link
Member Author

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

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

writeToDisk leads the compile time keep increasing.
2 participants