-
src/services/ethersService.ts- Created -
src/hooks/useVideoPlayerLazy.ts- Created -
src/components/video/VideoPlayerLazy.tsx- Created -
src/app/components/quizzes/question-types/CodeChallengeQuestion.tsx- Modified (dynamic import) -
src/services/serviceAccount.ts- Modified (uses ethersService) -
src/app/video-player-demo/page.tsx- Modified (uses VideoPlayerLazy) -
next.config.ts- Modified (bundle analyzer + splitChunks) -
package.json- Modified (added build:analyze script + dependencies)
- All new files follow project TypeScript conventions
- ESLint compliance maintained
- No console.log statements (except error handling)
- Proper error handling in lazy-load functions
- Loading states for all dynamic components
Run these commands in order after dependencies install:
pnpm run type-checkExpected Output: ✅ No errors
Note: One @ts-ignore in ethersService.ts is intentional for dynamic import
pnpm run lintExpected Output: ✅ No warnings or errors
pnpm run buildExpected Output:
- ✅ Build completes successfully
- ✅ Separate chunks visible in console output:
monaco-editor.jsvideo-player.jsethers.js
pnpm run build:analyzeExpected Output:
- ✅ Generates
.next/analyze/client.html - ✅ Generates
.next/analyze/server.html - ✅ Monaco, video.js, ethers visible as separate async chunks
- ✅ Initial bundle size reduced by 200KB+ gzipped
The GitHub Actions workflow (.github/workflows/ci.yml) will run:
- ✅ Type Check:
pnpm run type-check - ✅ Lint:
pnpm run lint - ✅ Validate UI:
pnpm run validate:ui - ✅ Validate Web3:
pnpm run validate:web3
- ✅ Install:
pnpm install --frozen-lockfile - ✅ Build:
pnpm run build - ✅ Verify: Check for
.next/build-manifest.json
- ✅ Tests:
pnpm run test(30s timeout)
After CI passes, manually verify:
- Navigate to quiz page with code challenge
- Verify loading spinner appears briefly
- Verify code editor loads correctly
- Type code and verify syntax highlighting works
- Run tests and verify test execution works
- Check browser DevTools Network tab:
-
monaco-editorchunk loaded separately - Loaded only when needed
-
- Navigate to video player demo page
- Verify loading spinner appears briefly
- Verify video player loads correctly
- Test play/pause functionality
- Test volume controls
- Test playback speed selection
- Test quality selection
- Test bookmarks feature
- Test annotations feature
- Test transcript navigation
- Check browser DevTools Network tab:
-
video-playerchunk loaded separately - video.js CSS loaded from CDN
- Loaded only when needed
-
- Trigger any Web3 feature (if applicable)
- Verify wallet operations complete
- Verify signing works
- Check browser DevTools Network tab:
-
etherschunk loaded separately - Loaded only when Web3 feature accessed
-
Run lighthouse audit or use Chrome DevTools:
Metrics to Check:
- Initial Bundle Size: Should be 200-500KB smaller (gzipped)
- Time to Interactive (TTI): Should improve by 30-40%
- Largest Contentful Paint (LCP): Should improve by 20-30%
- Total Blocking Time (TBT): Should decrease significantly
- First Input Delay (FID): Should improve
Open .next/analyze/client.html and verify:
- monaco-editor chunk exists (~250KB gzipped)
- video-player chunk exists (~180KB gzipped)
- ethers chunk exists (~300KB gzipped)
- Main bundle no longer contains these libraries
- Total initial bundle size reduced by 200KB+ gzipped
- Check
ethersService.tshas@ts-ignorefor dynamic import - Verify all imports use correct paths
- Run
pnpm run type-checklocally
- Run
pnpm run lint:fixto auto-fix issues - Check for missing semicolons or formatting
- Verify no unused imports
- Check all dynamic imports use correct syntax
- Verify
next.config.tssyntax is correct - Check webpack config doesn't have typos
- Run
pnpm installto ensure dependencies installed
- Check if any tests import the changed files directly
- Update test mocks if needed
- Verify lazy loading doesn't break test environment
- Check
next.config.tswebpack config - Verify
chunks: 'async'is set correctly - Run with
ANALYZE=trueto debug - Check console output for webpack warnings
- Type check runs without errors
- Lint runs without warnings
- Build completes successfully
- All tests pass
- Bundle analysis shows separate chunks
- Initial bundle reduced by 200KB+ gzipped
- All features work correctly in browser
- CI pipeline completes successfully
- No console errors in browser
- Performance metrics improved
If issues occur, rollback by:
-
Revert Code Changes:
git checkout HEAD~1 -- src/app/components/quizzes/question-types/CodeChallengeQuestion.tsx git checkout HEAD~1 -- src/services/serviceAccount.ts git checkout HEAD~1 -- src/app/video-player-demo/page.tsx git checkout HEAD~1 -- next.config.ts git checkout HEAD~1 -- package.json
-
Remove New Files:
rm src/services/ethersService.ts rm src/hooks/useVideoPlayerLazy.ts rm src/components/video/VideoPlayerLazy.tsx
-
Reinstall Dependencies:
pnpm install
-
Rebuild:
pnpm run build
- All files committed
- Commit messages are clear
- Documentation updated
- CI passes locally
- Manual testing completed
- Performance metrics verified
- No breaking changes
- Bundle analysis reviewed
- Code reviewed for quality
- Ready for production
# Install dependencies
pnpm install
# Type check
pnpm run type-check
# Lint
pnpm run lint
# Build
pnpm run build
# Build with analysis
pnpm run build:analyze
# Run tests
pnpm run test
# Development server
pnpm run dev
# Validate UI
pnpm run validate:ui
# Validate Web3
pnpm run validate:web3All implementation complete. Run the commands above to verify everything works as expected.
Estimated CI Runtime: 5-8 minutes
Expected Result: ✅ ALL CHECKS PASS