-
Notifications
You must be signed in to change notification settings - Fork 96
parallel-webpack causes bundle-analyser create empty/broken stats file #85
Comments
I tried this with the both 3.0.0-alpha.1 and 3.0.0-alpha.2 and in both the reports are made but the json files are empty. |
Could it be because |
UP, I have the same issue with 16 parallel builds. The one that builds last finishes all build process before webpack-bundle-analyzer starts so I miss bundle analysis report for that last built bundle. |
@frvge I think that could help with the issue as recommended by documentation: https://nodejs.org/api/process.html#process_process_exit_code |
So, me and @byara found out that the processes are eagerly terminated without waiting for stuff like plugins to finish. These particular lines in index.js caused the issue: https://github.com/trivago/parallel-webpack/blob/master/index.js#L141-L144 }).finally(function () {
workerFarm.end(workers);
process.removeListener('SIGINT', shutdownCallback);
}); Changing the lines to delay the killing of the workers made it possible for all (but not guaranteed) async operations to complete: }).finally(function () {
var __timeout = setTimeout(() => {
clearTimeout(__timeout)
workerFarm.end(workers);
process.removeListener('SIGINT', shutdownCallback);
}, 10000)
}); There must be a better way to detect when webpack has fully completed its job, then only exit. Maybe with some kind of compilation hook? |
Update |
I tried to apply what @liangchunn suggested here. Unfortunately, now the last reports are mostly "unfinished". It seems, if there was enough time and the stats file was small enough, they are created properly but if they are huge, webpack-bundle-analyzer makes stats files undone. As @liangchunn pointed out, with my changes, the reports are now made synchronously https://github.com/byara/webpack-bundle-analyzer/blob/master/src/BundleAnalyzerPlugin.js#L58-L69, so there must be other reasons to this behavior. |
After the merge of the PR in v2.3.0 we have the option to pass |
Explain the problem
I'm using parallel-webpack and webpack-bundle-analyser and it seems that parallel-webpack is causing webpack-bundle-analyser stop creating the reports midway so I sometimes end up with the correctly made stats or sometimes empty or invalid json files.
Might be related to: webpack-contrib/webpack-bundle-analyzer#152 (comment)
Expected Behaviour
to let webpack-bundle-analyser finish creating the report
Actual Behaviour
stops webpack-bundle-analyser from creating the reports causing indeterministic behavior
Steps to reproduce
has to be done on a large codebase with about 10 or more builds in parallel.
Provide your webpack config
Provide your Environment details
8.11.3
macOS High Sierra
^4.17.1
^2.3.0
The text was updated successfully, but these errors were encountered: