Skip to content

perf: reduce bundle size by 34% (35MB → 23MB)#262

Merged
sorrycc merged 1 commit intomasterfrom
perf/reduce-bundle-size
Mar 22, 2026
Merged

perf: reduce bundle size by 34% (35MB → 23MB)#262
sorrycc merged 1 commit intomasterfrom
perf/reduce-bundle-size

Conversation

@sorrycc
Copy link
Copy Markdown
Member

@sorrycc sorrycc commented Mar 21, 2026

Summary

  • Deduplicate shiki via resolve.dedupe: ["shiki"] in electron-vite config — @pierre/diffs (shiki@3) and the app (shiki@4) were each bundling their own copy of all 230+ language grammars and 65+ themes, producing 232 byte-identical duplicate chunks. This eliminates ~9 MB of JS.
  • Resize PNG app icons from 1024–1646px originals down to 64×64 — these icons render at size-4 (16×16 CSS / 32×32 Retina), so 64px provides 4× coverage. Saves ~1.7 MB.
Metric Before After Change
Total dist 35 MB 23 MB -12 MB (-34%)
JS files 696 393 -303 files
JS total 29.3 MB 20.3 MB -9 MB (-31%)
PNG icons 1.8 MB 48 KB -1.7 MB (-97%)
Duplicate chunks 232 3 -229

Test plan

  • bun ready passes (format + typecheck + lint + 261 tests)
  • Verify app icons render correctly in the "Open in" dropdown
  • Verify code highlighting works in chat messages (shiki)
  • Verify diff viewer works (MultiFileDiff / @pierre/diffs)
  • Verify mermaid diagrams render in markdown

Two optimizations:

1. Deduplicate shiki across @pierre/diffs (shiki@3) and app (shiki@4) via
   resolve.dedupe, eliminating 232 duplicate language/theme grammar chunks.

2. Resize PNG app icons from 1024-1646px to 64x64 (displayed at 16x16 CSS).
@github-actions
Copy link
Copy Markdown

Build Ready

Architecture Download Size
Apple Silicon Download 187.46 MB
Intel Download 195.14 MB

@sorrycc sorrycc merged commit 4835172 into master Mar 22, 2026
6 checks passed
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.

1 participant