Skip to content

Package and build size#366

Merged
gregnazario merged 3 commits intomainfrom
cursor/package-and-build-size-5e91
Mar 17, 2026
Merged

Package and build size#366
gregnazario merged 3 commits intomainfrom
cursor/package-and-build-size-5e91

Conversation

@gregnazario
Copy link
Collaborator

@gregnazario gregnazario commented Feb 6, 2026

Optimize dependencies and build configuration to significantly reduce bundle size and improve caching.

Dependency Optimizations

  • Remove @iconify/json (~390MB): The full icon set was in dependencies but only the ph (Phosphor) set is used. @iconify-json/ph (~4.4MB) was already in devDependencies.
  • Replace firebase with @firebase/app + @firebase/auth: Only Firebase App and Auth were used. Switching to modular packages reduces the dependency tree by ~17MB.
  • Replace octokit with @octokit/core: Only .request() was used (for rate limit checks). The full octokit SDK bundles many unused plugins.
  • Remove @astrojs/tailwind: Unused Astro integration — the project uses Tailwind v4 directly via @tailwindcss/vite.

Build Optimizations

  • react-syntax-highlighter PrismLight: Switched from Prism (loads all ~300 languages) to PrismLight with 12 specifically registered languages (bash, go, javascript, json, move, python, rust, solidity, toml, tsx, typescript, yaml), dramatically reducing the chat widget bundle.
  • Custom Move language grammar: Added prism-move.ts — a refractor-compatible Prism grammar for Move 2.x syntax (modules, structs, enums, abilities, address literals, annotations, control flow). Replaces the previous move → rust fallback in the chat widget.
  • Vite manual chunks: Configured manualChunks to split Firebase and React vendor code into separate, independently-cacheable chunks.

Dynamic Loading

  • Firebase SDK lazy loading: Converted @firebase/app and @firebase/auth to dynamic import(). The vendor-firebase chunk (~155KB) is now only fetched when a user interacts with auth (Faucet page), not eagerly on every page.
  • ChatMessage lazy loading: Wrapped in React.lazy() + Suspense so react-markdown, react-syntax-highlighter, remark-gfm, and all Prism grammars are deferred until chat messages actually render.
Open in Web Open in Cursor 

@cursor
Copy link

cursor bot commented Feb 6, 2026

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

@vercel
Copy link

vercel bot commented Feb 6, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
aptos-docs Ready Ready Preview, Comment Mar 17, 2026 0:40am

Request Review

@gregnazario gregnazario marked this pull request as ready for review February 6, 2026 15:11
@gregnazario gregnazario requested review from Copilot and moonclavedev and removed request for Copilot February 6, 2026 15:11
Copilot AI review requested due to automatic review settings February 6, 2026 15:39
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

- Replace firebase (32MB) with modular @firebase/app + @firebase/auth (~15MB)
- Remove @iconify/json (390MB) - @iconify-json/ph (4.4MB) already covers all used icons
- Replace octokit with lighter @octokit/core (only .request() method needed)
- Remove unused @astrojs/starlight-tailwind and @astrojs/tailwind (using @tailwindcss/vite)
- Optimize react-syntax-highlighter: use PrismLight with only needed languages + ESM imports
- Add Vite manual chunks for Firebase and React vendor splitting
…ighlighting

Replace the move->rust fallback with a proper Move language grammar that
handles Move 2.x syntax: modules, structs, enums, abilities, address
literals, annotations, and common control flow keywords.
- Convert Firebase app and auth initialization to async with dynamic imports.
  The vendor-firebase chunk (~155KB) is now only fetched when a user
  interacts with auth (Faucet page), not eagerly on every page.
- Lazy-load ChatMessage via React.lazy() so react-markdown,
  react-syntax-highlighter, remark-gfm, and Prism language grammars
  are deferred until chat messages are actually rendered.
- Both changes reduce the initial page load for the vast majority of
  users who never use the Faucet or the chat widget.
@cursor cursor bot force-pushed the cursor/package-and-build-size-5e91 branch from c0a575c to 67a5e8a Compare March 17, 2026 00:36
@gregnazario gregnazario enabled auto-merge (rebase) March 17, 2026 00:56
@gregnazario gregnazario disabled auto-merge March 17, 2026 00:56
@gregnazario gregnazario merged commit 3e97b17 into main Mar 17, 2026
7 checks passed
@gregnazario gregnazario deleted the cursor/package-and-build-size-5e91 branch March 17, 2026 00:56
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.

3 participants