Skip to content

Report extension compressed bundle size using Brotli - #8400

Open
igor10k wants to merge 1 commit into
mainfrom
i10k/brotli-bundle-size
Open

Report extension compressed bundle size using Brotli#8400
igor10k wants to merge 1 commit into
mainfrom
i10k/brotli-bundle-size

Conversation

@igor10k

@igor10k igor10k commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Why?

The build output prints a compressed size estimate (... built in 123ms (215.4 KB original, ~48.1 KB compressed)) so developers can stay under the platform's compressed-size limit for remote-DOM extensions (64 KB for checkout). The platform now measures that limit with Brotli instead of deflate, so the CLI's deflate-based estimate overestimates and no longer matches what's enforced.

What?

Compress with Brotli using the same settings as the platform: quality 11.

Trade-off: brotli-11 costs ~1ms/KB per rebuild (incl. app dev watch loop) — ≤ ~0.3s for realistic bundles, acceptable for a number that matches the enforced limit exactly.

Testing

  1. Run app build (or app dev) on an app with a checkout UI extension.
  2. Check the ~Y KB compressed suffix matches zlib.brotliCompressSync at quality 11 on the built JS.

@igor10k igor10k changed the title Report extension compressed bundle size using Brotli to match the platform size gate Report extension compressed bundle size using Brotli Aug 25, 2026
@github-actions github-actions Bot added the Area: @shopify/app @shopify/app package issues label Aug 25, 2026
@igor10k
igor10k force-pushed the i10k/brotli-bundle-size branch from 437ee8c to 30c4e00 Compare August 25, 2026 20:36
@igor10k
igor10k marked this pull request as ready for review August 25, 2026 20:45
@igor10k
igor10k requested a review from a team as a code owner August 25, 2026 20:45
@igor10k
igor10k requested review from vividviolet and a lite review from Copilot August 25, 2026 20:45

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the CLI’s extension bundle-size reporting to align with the platform’s enforced compressed-size limit by switching the compression estimate from deflate to Brotli (quality 11), ensuring developers see a size number that matches the real gate.

Changes:

  • Replace deflate-based compression sizing with Brotli compression at quality 11 when computing the reported “~X KB compressed” size.
  • Update tests to validate Brotli-based sizing and keep formatting behavior consistent.
  • Add a changeset documenting the user-visible change in reported compressed bundle size.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
packages/app/src/cli/services/build/bundle-size.ts Switch compressed size computation from deflate to brotliCompress with quality 11.
packages/app/src/cli/services/build/bundle-size.test.ts Update tests/helpers to assert Brotli-compressed byte sizes and preserve output formatting expectations.
.changeset/brotli-bundle-size-report.md Record the user-facing change as a patch release note for @shopify/app.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: @shopify/app @shopify/app package issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants