Skip to content

Mobile lag: Shiki grammar registry bundles 2.3MB of JS into workspace-checkout-display, no service worker for caching #1063

Closed

Description

@toasterman234

Implementation Plan

We'll tackle items 3-5 from the issue body:

  1. Tree-shake the grammar registration map — bundle only the top 15-20 languages
  2. Split workspace-checkout-display into editor-only vs viewer-only chunks
  3. Add bundle size budget CI check

Phase 1: Audit

  • Identify where the Shiki grammar registry is constructed in the bb source
  • Determine which languages are actually used on critical paths (thread view vs editor)
  • Measure current chunk sizes as baseline

Phase 2: Tree-shake grammars (#3)

  • Extract the grammar registration map into a separate file with explicit imports for the top 15-20 languages
  • Make remaining 150+ languages truly on-demand (dynamic import when first requested, not eagerly registered)
  • Verify workspace-checkout-display shrinks substantially

Phase 3: Split workspace chunks (#4)

  • Separate the viewer-only code path from the full editor path
  • Lazy-load the Shiki engine only when the user opens a file for editing
  • Verify the thread-view route doesn't pull in Shiki at all

Phase 4: Bundle budget CI (#5)

  • Add bundle size budget to Vite config (or CI step)
  • Set thresholds: 500KB max per chunk uncompressed, 1.5MB total initial payload
  • Wire into CI so PRs that regress bundle size fail

Phase 5: Verify

  • Re-measure workspace-checkout-display.js size
  • Re-test on iPhone via Safari Web Inspector Timelines
  • Confirm click latency under 50ms parse/compile time

Activity

  1. added a commit that references this issue on Aug 6, 2026
    b6c6ded
  2. added a commit that references this issue on Aug 14, 2026
    1690c0a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions