Skip to content

Smaller bundle#7013

Merged
gonzaloriestra merged 27 commits intomainfrom
smaller-bundle
Mar 24, 2026
Merged

Smaller bundle#7013
gonzaloriestra merged 27 commits intomainfrom
smaller-bundle

Conversation

@gonzaloriestra
Copy link
Copy Markdown
Contributor

@gonzaloriestra gonzaloriestra commented Mar 13, 2026

WHY are these changes introduced?

The CLI bundle is larger than necessary.

WHAT is this pull request doing?

Reduces CLI bundle size by ~55% (62 MB28 MB)

  • Enable minifyWhitespace and minifyIdentifiers in esbuild (previously only minifySyntax was on)
  • Exclude source map files from the npm package via !/dist/**/*.map in files (maps are still generated for Observe)
  • Replace brotli JS package with native zlib.brotliCompressSync
  • Simplify entry points instead of globbing all .ts files

How to test your changes?

  • pnpm bundle-for-release and check dist folder
  • npm i -g --@shopify:registry=https://registry.npmjs.org @0.0.0-snapshot-20260318104923
  • shopify app deploy (exercises brotli compression)

Measuring impact

How do we know this change was effective? Please choose one:

  • n/a - this doesn't need measurement, e.g. a linting rule or a bug-fix
  • Existing analytics will cater for this addition
  • PR includes analytics changes to measure impact

Checklist

  • I've considered possible cross-platform impacts (Mac, Linux, Windows)
  • I've considered possible documentation changes

@gonzaloriestra
Copy link
Copy Markdown
Contributor Author

/snapit

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 13, 2026

Coverage report

St.
Category Percentage Covered / Total
🟢 Statements 82.17% 14929/18169
🟡 Branches 74.52% 7375/9897
🟢 Functions 81.29% 3776/4645
🟢 Lines 82.55% 14116/17099

Test suite run success

3933 tests passing in 1514 suites.

Report generated by 🧪jest coverage report action from 8fa1647

@gonzaloriestra
Copy link
Copy Markdown
Contributor Author

/snapit

@github-actions
Copy link
Copy Markdown
Contributor

🫰✨ Thanks @gonzaloriestra! Your snapshot has been published to npm.

Test the snapshot by installing your package globally:

npm i -g --@shopify:registry=https://registry.npmjs.org @shopify/cli@0.0.0-snapshot-20260313171105

Caution

After installing, validate the version by running shopify version in your terminal.
If the versions don't match, you might have multiple global instances installed.
Use which shopify to find out which one you are running and uninstall it.

Comment thread packages/cli/bin/bundle.js Outdated
Comment thread packages/cli/bin/bundle.js Outdated
@gonzaloriestra gonzaloriestra force-pushed the smaller-bundle branch 2 times, most recently from 9893f54 to 696e5f7 Compare March 17, 2026 15:10
Copy link
Copy Markdown
Contributor Author

/snapit

@github-actions
Copy link
Copy Markdown
Contributor

🫰✨ Thanks @gonzaloriestra! Your snapshot has been published to npm.

Test the snapshot by installing your package globally:

npm i -g --@shopify:registry=https://registry.npmjs.org @shopify/cli@0.0.0-snapshot-20260317160706

Caution

After installing, validate the version by running shopify version in your terminal.
If the versions don't match, you might have multiple global instances installed.
Use which shopify to find out which one you are running and uninstall it.

Comment thread packages/cli/bin/bundle.js Outdated
Comment thread packages/cli/bin/bundle.js
Comment thread packages/cli/bin/bundle.js Outdated
Copy link
Copy Markdown
Contributor Author

/snapit

@github-actions
Copy link
Copy Markdown
Contributor

🫰✨ Thanks @gonzaloriestra! Your snapshot has been published to npm.

Test the snapshot by installing your package globally:

npm i -g --@shopify:registry=https://registry.npmjs.org @shopify/cli@0.0.0-snapshot-20260318104923

Caution

After installing, validate the version by running shopify version in your terminal.
If the versions don't match, you might have multiple global instances installed.
Use which shopify to find out which one you are running and uninstall it.

@gonzaloriestra gonzaloriestra marked this pull request as ready for review March 18, 2026 14:38
@gonzaloriestra gonzaloriestra requested a review from a team as a code owner March 18, 2026 14:38
@github-actions
Copy link
Copy Markdown
Contributor

We detected some changes at packages/*/src and there are no updates in the .changeset.
If the changes are user-facing, run pnpm changeset add to track your changes and include them in the next release CHANGELOG.

Caution

DO NOT create changesets for features which you do not wish to be included in the public changelog of the next CLI release.

Copy link
Copy Markdown
Contributor

@craigmichaelmartin craigmichaelmartin left a comment

Choose a reason for hiding this comment

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

So cool! Thank you for leading these autoresearch improvements!!

Copy link
Copy Markdown
Contributor

@dmerand dmerand left a comment

Choose a reason for hiding this comment

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

I love this approach overall! Review found a couple of concerns worth addressing prior to shipping.

Comment thread packages/cli/bin/bundle.js Outdated
Comment thread packages/cli/bin/bundle.js
@gonzaloriestra
Copy link
Copy Markdown
Contributor Author

/snapit

@github-actions
Copy link
Copy Markdown
Contributor

🫰✨ Thanks @gonzaloriestra! Your snapshot has been published to npm.

Test the snapshot by installing your package globally:

npm i -g --@shopify:registry=https://registry.npmjs.org @shopify/cli@0.0.0-snapshot-20260319110410

Caution

After installing, validate the version by running shopify version in your terminal.
If the versions don't match, you might have multiple global instances installed.
Use which shopify to find out which one you are running and uninstall it.

… — saves ~5,904 KB\n\nResult: {"status":"keep","bundle_kb":125332,"js_kb":46412,"maps_kb":74152,"assets_kb":4768}
…784, maps: -2,328)\n\nResult: {"status":"keep","bundle_kb":111220,"js_kb":34628,"maps_kb":71824,"assets_kb":4768}
…ings)\n\nResult: {"status":"keep","bundle_kb":99508,"js_kb":30844,"maps_kb":63896,"assets_kb":4768}
…. Already lazy-loaded via dynamic import.\n\nResult: {"status":"keep","bundle_kb":76368,"js_kb":22848,"maps_kb":48752,"assets_kb":4768}
…ble at runtime as project dep.\n\nResult: {"status":"keep","bundle_kb":57192,"js_kb":16500,"maps_kb":35924,"assets_kb":4768}
…dable (identifiers not minified).\n\nResult: {"status":"keep","bundle_kb":21440,"js_kb":16500,"maps_kb":172,"assets_kb":4768}
…36)\n\nResult: {"status":"keep","bundle_kb":16776,"js_kb":11836,"maps_kb":172,"assets_kb":4768}
…,132 KB\n\nResult: {"status":"keep","bundle_kb":15644,"js_kb":10704,"maps_kb":172,"assets_kb":4768}
…s 524 KB\n\nResult: {"status":"keep","bundle_kb":15120,"js_kb":10180,"maps_kb":172,"assets_kb":4768}
… KB\n\nResult: {"status":"keep","bundle_kb":14128,"js_kb":9188,"maps_kb":172,"assets_kb":4768}
…conciler@0.29.2) — saves 424 KB\n\nResult: {"status":"keep","bundle_kb":13704,"js_kb":8764,"maps_kb":172,"assets_kb":4768}
…ed impact)\n\nResult: {"status":"keep","bundle_kb":13592,"js_kb":8652,"maps_kb":172,"assets_kb":4768}
…Result: {"status":"keep","bundle_kb":13176,"js_kb":8236,"maps_kb":172,"assets_kb":4768}
…-parser, @vscode/web-custom-data — saves 1,136 KB\n\nResult: {"status":"keep","bundle_kb":12040,"js_kb":7100,"maps_kb":172,"assets_kb":4768}
…mver, yaml, js-yaml, execa — saves 1,100 KB\n\nResult: {"status":"keep","bundle_kb":10940,"js_kb":6000,"maps_kb":172,"assets_kb":4768}
…eing bundled) — saves 348 KB\n\nResult: {"status":"keep","bundle_kb":10592,"js_kb":5652,"maps_kb":172,"assets_kb":4768}
… 20+ more runtime deps — saves 1,868 KB\n\nResult: {"status":"keep","bundle_kb":8724,"js_kb":3784,"maps_kb":172,"assets_kb":4768}
@gonzaloriestra gonzaloriestra dismissed dmerand’s stale review March 24, 2026 09:59

Comments already addressed

@gonzaloriestra gonzaloriestra added this pull request to the merge queue Mar 24, 2026
Merged via the queue into main with commit 1ab6618 Mar 24, 2026
29 checks passed
@gonzaloriestra gonzaloriestra deleted the smaller-bundle branch March 24, 2026 10:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants