package-build-stats
package-build-stats copied to clipboard
Support for Brotli Compression
I wanted to make a size comparison between actual size, gzip, and brotli. Would you be open to adding the brotli compression size?
I would imagine it being some like the following change within build.utils.ts
:
import { gzipSync, brotliCompressSync } from 'zlib'
const brotli = brotliCompressSync(bundleContents, {}).length
and then returning that brotli size.
return {
...,
type: extension,
size: asset.size,
gzip,
brotli,
parse: parseTimes,
}
Happy to add optional support (off by default) for brotli if someone wants to give this a shot. Optional because brotli compression can be quite a bit slower.