-
-
Notifications
You must be signed in to change notification settings - Fork 488
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
Make webpack's done hook wait until analyzer writes report / stat file. #247
Make webpack's done hook wait until analyzer writes report / stat file. #247
Conversation
Nice work! This fixes the issue in my reproducible repo mentioned in #232. |
src/BundleAnalyzerPlugin.js
Outdated
actions.forEach(action => action()); | ||
setImmediate(async () => { | ||
try { | ||
for (let i = 0, len = actions.length; i < len; ++i) await actions[i](); |
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.
I don't think we need to pre-optimise the loop here. AFAIK V8's optimising compiler does this for us automatically.
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.
You mean write it as for (let i = 0; i < actions.length; ...
instead?
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.
Yes, IMO for(let i = 0; i < actions.length; i++)
more readable than for(let i = 0, len = actions.length; i < len; ++i )
, plus it wouldn't make a huge difference in terms of perf.
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.
Sure, no problem.
This is looking good to me, thanks! Have you checked which version of |
|
@mareolan thanks a lot! |
This is now released in v3.0.4. Thank you for your contributions! |
Fixes #232 by prolonging webpack's "done" hook until analyzer finishes writing report / stat files.