# Optimized Builds for Slower CPUs This document provides instructions for building the project on slower CPUs or resource-constrained environments. ## Quick Start Run the optimized build using: ```bash pnpm run build:optimized ``` ## Optimization Features The following optimizations have been implemented to improve build performance: 1. **Memory Limit Control**: Sets Node.js memory limit to prevent crashes on memory-constrained systems 2. **Build Cache Management**: Automatically cleans up caches to prevent bloat 3. **TypeScript/ESLint Skip**: Skips type checking and linting during production builds 4. **Code Splitting**: Implements React.lazy() for code splitting and lazy loading 5. **Source Map Disabling**: Disables source maps in production for faster builds ## Manual Optimization Steps If you need to manually optimize the build process: ### 1. Clean the caches ```bash pnpm run clean ``` ### 2. Set Node.js memory limit ```bash export NODE_OPTIONS="--max-old-space-size=4096" ``` ### 3. Skip non-essential checks ```bash NEXT_SKIP_LINT=1 NEXT_SKIP_TS_CHECK=1 pnpm run build ``` ### 4. Use SWC compiler with optimized settings ```bash NEXT_TELEMETRY_DISABLED=1 pnpm run build:fast ``` ## Configuration Files The following configuration files have been optimized: - **next.config.mjs**: Contains SWC optimizations and standalone output - **.pnpmrc**: Configures Node.js memory limits and disables notifications - **.env.production**: Sets environment variables for production builds ## Troubleshooting ### Out of Memory Errors If you encounter "JavaScript heap out of memory" errors, try: ```bash export NODE_OPTIONS="--max-old-space-size=2048" pnpm run build:fast ``` ### Slow Builds If builds are still slow: 1. Try running with lower memory settings 2. Disable unnecessary parts of the app temporarily 3. Build incrementally using `next build --no-lint`