Skip to content

perf: implement lazy loading and bundle splitting (resolves #1382)#1564

Open
basantnema31 wants to merge 1 commit into
magic-peach:mainfrom
basantnema31:perf/lazy-loading-image-optimization
Open

perf: implement lazy loading and bundle splitting (resolves #1382)#1564
basantnema31 wants to merge 1 commit into
magic-peach:mainfrom
basantnema31:perf/lazy-loading-image-optimization

Conversation

@basantnema31

Copy link
Copy Markdown

Closes #1382

Summary

Implements a comprehensive lazy loading and bundle splitting strategy to reduce initial page load time and Time to Interactive (TTI).

Changes

src/app/page.tsx

  • Replaced eager import of VideoEditor (32 KB) with next/dynamic + ssr: false
    • Shows an animated spinner while the editor chunk loads
  • Replaced eager import of Footer with next/dynamic + ssr: false
    • Footer is below the fold and never needs to block first paint

src/components/VideoEditor.tsx

  • Replaced eager import of ThumbnailStrip (13 KB) with next/dynamic
    • Only rendered after a file is uploaded — never needed at first paint
    • Shows an animated skeleton placeholder while loading
  • Replaced eager import of OnboardingTour (11 KB) with next/dynamic
    • Only shown once on first visit — deferred completely to after hydration
  • LottiePlayer was already using dynamic import()

next.config.ts

  • Added optimizePackageImports: ["lucide-react"] — tree-shakes unused icons
  • Added webpack splitChunks config with dedicated ffmpeg and vendor cache groups for long-term browser caching

Impact

Metric Before After
Initial JS sent to browser Entire editor + all components Only shell + async chunks
VideoEditor chunk Eagerly loaded Deferred until after first paint
ThumbnailStrip + OnboardingTour Always loaded Only loaded when needed
lucide-react Full library Tree-shaken to used icons only
ffmpeg.wasm Part of main bundle Separate cached chunk

@vercel

vercel Bot commented Jun 10, 2026

Copy link
Copy Markdown

Someone is attempting to deploy a commit to the magic-peach1's projects Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions

Copy link
Copy Markdown
Contributor

✅ PR Format Check Passed — @basantnema31

Basic format checks passed. A maintainer will review your code changes.

This does not mean the PR is approved — it just means the format is correct.

@github-actions github-actions Bot added the level:intermediate Intermediate level - 35 pts label Jun 10, 2026
@github-actions

Copy link
Copy Markdown
Contributor

👋 Thanks for your PR, @basantnema31!

Welcome to Reframe — a browser-based video editor built for everyone 🎬

What happens next

  1. 🤖 Automated checks — build & TypeScript typecheck will run automatically
  2. Vercel preview — a preview deployment will be created (requires maintainer authorization for fork PRs)
  3. 👀 Code review — a maintainer will review your changes
  4. 🚀 Merge — once approved, your PR will be merged!

Quick checklist

  • PR title follows Conventional Commits (e.g. feat: add dark mode)
  • Linked the issue this PR closes (e.g. Closes #123)
  • Tested the changes locally (bun run dev)
  • Build passes (bun run build)

Useful links

Happy coding! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

level:intermediate Intermediate level - 35 pts

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Performance] Optimize Application Load Time by Implementing Lazy Loading and Image Optimization

1 participant