webpack-bundle-analyzer icon indicating copy to clipboard operation
webpack-bundle-analyzer copied to clipboard

Add brotli size support

Open aldo-roman opened this issue 8 years ago β€’ 14 comments

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.

aldo-roman avatar Sep 06 '17 17:09 aldo-roman

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 ☺️

valscion avatar Sep 07 '17 07:09 valscion

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.

th0r avatar Sep 07 '17 07:09 th0r

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.

valscion avatar Sep 07 '17 07:09 valscion

πŸ‘

th0r avatar Sep 07 '17 07:09 th0r

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: image

aldo-roman avatar Sep 08 '17 20:09 aldo-roman

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

valscion avatar Sep 10 '17 07:09 valscion

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).

edmorley avatar May 15 '18 11:05 edmorley

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 :)

valscion avatar May 15 '18 12:05 valscion

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.

TheAlexLichter avatar Jan 18 '19 16:01 TheAlexLichter

Something new to this?

salztorte avatar Apr 03 '19 14:04 salztorte

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.

valscion avatar Apr 03 '19 14:04 valscion

When is this getting merged ?

278kunal avatar Jul 29 '19 13:07 278kunal

When someone who wants brotli size support does what we've described that needs to be done. See the comment right above yours.

valscion avatar Jul 29 '19 13:07 valscion

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.

raphaelbs avatar Apr 09 '20 21:04 raphaelbs