webpack-bundle-analyzer
webpack-bundle-analyzer copied to clipboard
Add brotli size support
This is a discussion issue to add Brotli size support on the report, side by side with gzip. On the app we support, 78% of users surf the web with a brotli-enabled browser. Global support is around 60%. This will increase in the next days after macOS High Sierra and iOS 11 are launched. See http://caniuse.com/#search=brotli
Also, in our tests, Brotli grants 10% more compression than Gzip. We are developing a Angular CLI, Angular 4+ app.
I will be experimenting with a fork to add Brotli by replicating the Gzip size implementation. Any suggestion and feedback is welcome.
Huh, never heard of Brotli before π . Awesome to learn new things!
@th0r should be able to answer with any suggestions and feedback, when he's got time. I'd like to at least see a proof-of-concept of this Brotli support if possible βΊοΈ
Never heard of Brotli as well. The only concern I have is the increasing of analyze time. Agree with @valscion here - it would be nice to see a proof-of-concept PR and comparison of analyze times with and without it.
It might be possible to add brotli support if it would be calculated only when some CLI or plugin option would be there. That way it would not increase analyze time for those who don't yet care about Brotli.
π
Hi guys, here there is the PR for Brotli support. It is working without problems on my setup. I couldn't include an opt-in option for the feature.
Here is a screenshot on how this looks:

Neat! I think it'll be necessary to have an opt-in somehow, but currently it might require some architectural changes. Large changes would cause difficult merge conflicts with #97, though β I hope I could get that finished some day π
I hope you're OK with using the Brotli support from your branch? It's a bit unlikely that we'll want to calculate these sizes by default as brotli isn't that widely used yet
If this does get implemented, please can the brotli related dependencies not be added to dependencies - to avoid issues like those in siddharthkp/bundlesize#202. (eg check for the dependencies at runtime and if not found and "brotli mode" enabled, output a suitable message.)
Re Brotli itself, we happily use it on several production sites, however I'm not sure of the value of displaying brotli sizes in the analyzer, given:
(a) brotli compression is much slower so would have much more of an impact on how long this plugin takes to run,
(b) whilst not entirely linear, one would presume the size ratios of the bundle for gzip vs brotli would be close enough that it wouldn't really affect any decisions based on the results (eg deciding what changes to make to splitChunks settings).
If this does get implemented, please can the brotli related dependencies not be added to dependencies - to avoid issues like those in siddharthkp/bundlesize#202. (eg check for the dependencies at runtime and if not found and "brotli mode" enabled, output a suitable message.)
Huh, thanks for the pointer :)
That should be easier now that native Brotli support (https://github.com/nodejs/node/blob/master/doc/changelogs/CHANGELOG_V11.md#notable-changes) landed in Node.
Something new to this?
https://github.com/webpack-contrib/webpack-bundle-analyzer/issues/113#issuecomment-327715838
The only concern I have is the increasing of analyze time. Agree with @valscion here - it would be nice to see a proof-of-concept PR and comparison of analyze times with and without it.
https://github.com/webpack-contrib/webpack-bundle-analyzer/issues/113#issuecomment-327717813
It might be possible to add brotli support if it would be calculated only when some CLI or plugin option would be there. That way it would not increase analyze time for those who don't yet care about Brotli.
https://github.com/webpack-contrib/webpack-bundle-analyzer/pull/114#issuecomment-357414002
The crux is that we don't want this to increase analyze time, and this feature would have to be opt-in. Currently it might require some architectural changes, though, so it isn't that easy to do.
When is this getting merged ?
When someone who wants brotli size support does what we've described that needs to be done. See the comment right above yours.
I have the use-case that the pipeline analysis doesn't use gzip at all, it relies completely on brotli. It would be great if it had the ability to choose one of them.