Skip to content

Improve page load performance with lazy loading, caching, and font cleanup#80

Open
faradayfury wants to merge 1 commit intomainfrom
perf/quick-wins
Open

Improve page load performance with lazy loading, caching, and font cleanup#80
faradayfury wants to merge 1 commit intomainfrom
perf/quick-wins

Conversation

@faradayfury
Copy link
Contributor

Summary

  • ThemedImage lazy loading — Added loading="lazy" and decoding="async" to inline images with a priority prop escape hatch for above-fold hero images
  • PostHog init deferral — Analytics initialization now waits for requestIdleCallback so it doesn't compete with hydration
  • Vercel cache headers — Added vercel.json with immutable 1-year cache for /fonts/* and /img/* (repeat visits load from browser cache)
  • lucide-react tree-shaking — Added to optimizePackageImports in next config
  • Font cleanup (648KB → 144KB) — Removed 17 unused font files: PPMori, THICCCBOI, all .woff IE11 fallbacks, and unused Delight ExtraLight/Light/Thin weights
  • NETWORK_KEY extracted — Moved to src/lib/constants.ts so importing it doesn't pull in the entire Web3Provider module

Context

Performance audit found 7.4MB raw / 2.1MB gzip of JS loading on every doc page. The dominant cost (5.5MB) is the Web3 stack bundled into a shared Turbopack chunk — fixing that requires moving showcase pages to a separate route (tracked separately). This PR covers the quick wins that don't require architectural changes.

Test plan

  • pnpm build passes (377 pages generated)
  • pnpm validate:precommit passes (lint + typecheck)
  • Verify ThemedImage renders correctly in both light/dark themes
  • Verify PostHog events still fire after deploy (check PostHog dashboard)
  • Verify fonts render correctly (Delight in headings, Geist in body)
  • Verify showcase pages still work (deposit, fast-bridge, swaps, etc.)

…eanup

- Add loading="lazy" and decoding="async" to ThemedImage inline images
  with a priority prop escape hatch for above-fold hero images
- Defer PostHog initialization via requestIdleCallback so analytics
  doesn't compete with hydration
- Add vercel.json with immutable cache headers for /fonts/* and /img/*
- Add lucide-react to optimizePackageImports for better tree-shaking
- Remove 17 unused font files (PPMori, THICCCBOI, .woff fallbacks,
  unused Delight weights) — 648KB → 144KB in public/fonts
- Extract NETWORK_KEY to shared constants module to avoid pulling
  Web3Provider imports for a string constant
@vercel
Copy link

vercel bot commented Mar 11, 2026

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

Project Deployment Actions Updated (UTC)
docs-fumadocs Ready Ready Preview, Comment Mar 11, 2026 9:49am

Request Review

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