generated from json-schema-org/repo-template
-
-
Notifications
You must be signed in to change notification settings - Fork 73
Open
Description
Problem
Lighthouse audit shows 631 KiB of unused JavaScript on initial page load. The Monaco Editor and other components load upfront even when not immediately needed, impacting performance on slower connections.
Proposed Solution
Implement code splitting to lazy-load non-critical components:
- Monaco Editor (~200-250 KiB savings)
- Lazy load only when user navigates to lesson pages
- Add loading skeleton for smooth UX
- Route-based splitting (~100-150 KiB savings)
- Dynamic imports for each chapter's content
- Load only active lesson data
- Component-level splitting (~50-100 KiB savings)
- Defer Certificate modal, Outline drawer, Feedback components
Expected Impact:
- Defer Certificate modal, Outline drawer, Feedback components
- Bundle size: -300-400 KiB
- LCP: -200-400ms
- Better experience on 3G/4G connections
Implementation
Monaco Editor:
// app/components/CodeEditor/CodeEditor.tsx
import dynamic from 'next/dynamic';
const Editor = dynamic(() => import('@monaco-editor/react'), {
loading: () => <EditorSkeleton />,
ssr: false
});Next.js Config:
experimental: {
optimizePackageImports: ['@chakra-ui/react', '@monaco-editor/react']
}
Files to Modify
- app/components/CodeEditor/CodeEditor.tsx
- app/content/layout.tsx
- next.config.mjs
- app/components/CertificateButton/CertificateButton.tsx
- app/components/OutlineDrawer/OutlineDrawer.tsx
Success Criteria
- Initial bundle reduced by 300+ KiB
- LCP < 1.4s
- Smooth loading states
- All tests pass
ARE YOU WORKING ON THIS
YES please assign me this issue
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels