fix(webapp): keep PNG palettes through sharp minification (dist 79MB -> ~56MB) #29
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/png-palette"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Upstream v11.7.10 replaced
image-webpack-loaderwithimage-minimizer-webpack-pluginusingsharpMinifyand empty PNG encode options (png: {}). sharp defaults to truecolor output, so paletted PNGs are re-encoded as RGBA and get dramatically larger.Measured by comparing the two CI dist artifacts on the git server:
2026080520260901emoji-sheets/apple-sheet.png3828x3828, 8-bit colormap— 4.87 MB3828x3828, 8-bit/color RGBA— 23.58 MBdist/emoji/*(~1,800 files)dist/filestotaldist/emojitotalThe emoji sprite sheet ships to every client that opens the emoji picker, so this is a real cost for subscribers on rural wireless links.
Note upstream already excludes GIFs from sharp for the same class of problem ("animated GIFs lose frames or grow in size when re-encoded by sharp") — PNGs just never got the equivalent guard.
The change
webapp/channels/webpack.config.jsis already a diverged file, so this adds no new entry toDIVERGENCE.md— only widens the existing row's note so the next merge keeps the option.Verification
build-webappmust produceapple-sheetback at ~4.9 MB and a dist tarball near 56 MB. Sincebuild-webappdoes not run on pull requests, that check happens after this merges — or viaworkflow_dispatch.This is very likely an upstream bug affecting all 11.7.10 builds and worth reporting to mattermost.