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
setImmediate
causes analyzer to only start after webpack's done
callback is invoked
#232
Comments
liangchunn
changed the title
Dec 5, 2018
setImmediate
causes webpack to call done
callback prematurelysetImmediate
causes webpack to invoke done
callback prematurely
liangchunn
changed the title
Dec 5, 2018
setImmediate
causes webpack to invoke done
callback prematurelysetImmediate
causes analyzer to only start after webpack's 'done' callback is invoked
liangchunn
changed the title
Dec 5, 2018
setImmediate
causes analyzer to only start after webpack's 'done' callback is invokedsetImmediate
causes analyzer to only start after webpack's done
callback is invoked
Thanks for the thorough issue report! We will get to this when we have time |
I've hit this issue too. There's another solution by using Webpack's |
This should be fixed in v3.0.4 now, let us know if that's not the case. |
rohit-gohri
added a commit
to smartprix/sm-webpack-config
that referenced
this issue
May 10, 2019
No need for it now as bundle-analyzer handles it now: webpack-contrib/webpack-bundle-analyzer#232
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Issue description
This issue stems from parallel-webpack#85 and is related to #152, and a PR in parallel-webpack#89 in an attempt to 'hack around' the faulty behaviour.
webpack-bundle-analyzer
is enqueueing the main analyze operation withsetImmediate
, which affects this plugin to execute only after a webpack build (which is executed with the Node.js API) has invoked thedone
callback.I suspect that when webpack is running, there are a lot of I/O operations being spawned by webpack (like reading and writing), therefore the actions that are defined and called using
setImmediate
are deferred after the webpack build has finished. Since there is no way to 'listen' when this plugin has successfully completed, this causes issues with tools that exits as soon as thedone
callback is fired (for example: tooling that spawns multiple webpack builds in parallel and hooks into thedone
callback to determine if they are done):Reproducible repository
I've created a minimal repository that reproduces this issue, and a detailed explanation here: https://github.com/liangchunn/webpack-bundle-analyzer-set-immediate-bug
Please read the README as it contains important things to watch out in order to understand how it actually works.
Possible fixes
setImmediate
, make it execute whenever the line is reached. This would change the behaviour of how people use it, and might echo logs between builds (Reference setTimeout -> setImmediate #21){ deferAnalyzer: boolean = true}
(true by default), and explicitly opt-out enqueuing operations withsetImmediate
by setting{ deferAnalyzer: false }
, which won't break everyone's build or change the way people are already using this pluginIn any case, I am open for a PR addressing this issue. Just let me know which route to go (or if there are any other possibilities to fix this issue).
Technical info
Debug info
How do you use this module? As CLI utility or as plugin?
plugin
If plugin, what options were provided? (e.g.
new BundleAnalyzerPlugin({ analyzerMode: 'disabled', generateStatsFile: true })
)What other Webpack plugins were used?
The text was updated successfully, but these errors were encountered: