Parcelglance puts a chat widget on Shopify storefronts. Third-party scripts on a storefront are guilty until proven innocent, so I made myself a promise and encoded it as a build check: the widget ships under 50 KB gzipped, or the build fails.
For months, every deploy printed this:
> postbuild > node scripts/check-widget-size.mjs
[widget-size] public/parcelglance-widget.js raw: 12.24 KB gzipped: 3.77 KB (limit 50.00 KB) β
Under the 50 KB gzipped claim.
Enter fullscreen mode
Exit fullscreen mode
Green. Every time. And meanwhile the file most merchants were actually downloading was 78 KB raw, about 75 KB over the wire, and the widget wasn't loading for a large group of them at all.
Three separate things were wrong, and the size gate was the one that made the other two invisible.
Two files, one gate, no overlap
The app had grown two ways to put a widget on a storefront.
The first was a theme app extension: a Liquid snippet that loads a loader script, which loads the real widget from /widget.js .β¦