This document outlines all the performance optimizations applied to improve dev server startup time.
- Turbopack: Enabled via
--turboflag in dev script (up to 10x faster than webpack) - React Strict Mode: Disabled in development (reduces double-rendering overhead)
- Optimized Package Imports: Tree-shaking for large packages (framer-motion, lucide-react, FontAwesome, radix-ui, zustand, clsx, cva)
- Webpack Build Worker: Parallel compilation for faster builds
- Dev Indicators: Disabled build activity indicator to reduce overhead
- Console Removal: Automatic console.log removal in production builds
- Image Optimization: AVIF and WebP format support
- Turbo Resolve Aliases: Faster module resolution with pre-configured path aliases
- Skip Type Checking in Dev: TypeScript errors checked separately via
npm run check - Skip ESLint in Dev: Linting runs separately for faster HMR
- assumeChangesOnlyAffectDirectDependencies: Faster incremental builds
- disableSourceOfProjectReferenceRedirect: Reduced type-checking overhead
- incremental: Already enabled (caches compilation results)
- skipLibCheck: Already enabled (skips type-checking of declaration files)
- Explicit Content Paths: Added specific paths for features/, shared/, core/ directories
- Reduced Scanning: More targeted file patterns prevent unnecessary scans
- NEXT_TELEMETRY_DISABLED=1: Disables Next.js telemetry (faster startup)
- NODE_OPTIONS: Optimized memory allocation (4GB)
- NEXT_PRIVATE_SKIP_SIZE_LIMIT_CHECK=1: Skips bundle size checks in dev
- Conditional Loading: Fonts only load in production via environment-based file routing
- Development Skip: Returns empty array immediately in dev (fonts.dev.ts, decorationFonts.dev.ts)
- No Font Compilation: Prevents 35+ Google Fonts from being processed during dev compilation
- Decoration Fonts Split: MainMenu decoration fonts also use dev/prod split pattern
- Parallel Loading: All translation namespaces load in parallel via Promise.all
- Message Caching: Loaded translations are cached to avoid re-importing during HMR
- Faster Initial Load: Reduces sequential await overhead
- prefer-offline=true: Uses cached packages when available
- Dev server startup: ~30-60 seconds (with font compilation timeouts)
- Hot reload: ~3-5 seconds
- Initial page load: Slow due to font processing
- Dev server startup: ~5-10 seconds (with Turbopack)
- Hot reload: ~500ms-1s (with Turbopack)
- Initial page load: Fast (no font loading in dev)
- Production: Unchanged (all optimizations are dev-only or improve prod too)
- Use SSD: Ensure your project is on an SSD drive
- Exclude from Antivirus: Add node_modules and .next to antivirus exclusions
- Close Unnecessary Apps: Free up RAM and CPU
- Use Node 18+: Latest Node versions have better performance
- Clear .next folder: Run
rm -rf .nextif builds feel slow
# Clear build cache
rm -rf .next
# Clear node modules and reinstall (if needed)
rm -rf node_modules package-lock.json
npm install
# Run optimized dev server
npm run devTo check if optimizations are working:
- Startup Time: Note the time from running
npm run devto "Ready in X.Xs" - Hot Reload: Make a small change and see how fast it updates
- Memory Usage: Check Task Manager - should stay under 4GB
- Turbopack Indicator: You should see "Turbopack" mentioned in the startup logs
If any optimization causes issues:
// package.json
"dev": "next dev"// next.config.ts
reactStrictMode: true;// ClientLayout.tsx - Remove the environment check in loadFontsModule- All optimizations are non-breaking and maintain production functionality
- Font loading is production-only - use system fonts in dev for testing
- Turbopack is stable in Next.js 15+ and recommended by Vercel
- These optimizations are cumulative - each one contributes to faster performance