package-build-stats icon indicating copy to clipboard operation
package-build-stats copied to clipboard

Support for Brotli Compression

Open ccortezaguilera opened this issue 3 years ago • 1 comments

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,
    }

ccortezaguilera avatar Nov 08 '20 21:11 ccortezaguilera

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.

pastelsky avatar Aug 21 '22 07:08 pastelsky