Skip to content

Enhance tree-shaking analysis with bundle size reporting and formatting utilities#7054

Merged
PavelVanecek merged 2 commits into
more-treeshaking-detailsfrom
copilot/sub-pr-7045
Feb 24, 2026
Merged

Enhance tree-shaking analysis with bundle size reporting and formatting utilities#7054
PavelVanecek merged 2 commits into
more-treeshaking-detailsfrom
copilot/sub-pr-7045

Conversation

Copilot AI commented Feb 24, 2026

Copy link
Copy Markdown
Contributor

Description

Adds bundle size reporting utilities to the tree-shaking analysis scripts, including minification and gzip size stages, human-readable formatting, and reduction percentage calculations.

New exports in scripts/treeshaking.ts:

  • formatBundleSize(bytes) — formats bytes to human-readable string (512 B, 1.00 KB, etc.)
  • getReductionPercent(baseline, reduced) — calculates size reduction as a percentage
  • getBundleSizeReport(components) — returns a full report across 4 stages: es6-folder, tree-shaken, minified, minified+gzip
  • Types: BundleSizeStage, BundleSizeReport

Dependencies: Added terser for minification.

Lock file: Rebased package-lock.json onto current main (rollup 4.59.0 + terser 5.46.0).

Related Issue

Motivation and Context

Tooling to understand the real-world impact of tree-shaking — raw bundle size alone is insufficient; minified+gzip size is what users actually ship.

How Has This Been Tested?

Unit tests cover formatBundleSize, getReductionPercent, and getBundleSizeReport including stage ordering, size relationships (minified ≤ tree-shaken, gzip ≤ minified), and reduction percentage monotonicity.

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • I have added a storybook story or VR test, or extended an existing story or VR test to show my changes

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI changed the title [WIP] Enhance tree-shaking analysis with bundle size reporting Enhance tree-shaking analysis with bundle size reporting and formatting utilities Feb 24, 2026
Copilot AI requested a review from PavelVanecek February 24, 2026 15:12
@PavelVanecek
PavelVanecek marked this pull request as ready for review February 24, 2026 22:59
@PavelVanecek
PavelVanecek merged commit 51c2759 into more-treeshaking-details Feb 24, 2026
@PavelVanecek
PavelVanecek deleted the copilot/sub-pr-7045 branch February 24, 2026 22:59
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.

2 participants