Files
wehub-resource-sync bb5c75ce05
Component Security Validation / Security Audit (push) Has been cancelled
Deploy to Cloudflare Pages / deploy (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 12:38:58 +08:00

1 line
5.1 KiB
JSON

{"content": "# Optimize Build Command\n\nOptimize build processes and speed\n\n## Instructions\n\nFollow this systematic approach to optimize build performance: **$ARGUMENTS**\n\n1. **Build System Analysis**\n - Identify the build system in use (Webpack, Vite, Rollup, Gradle, Maven, Cargo, etc.)\n - Review build configuration files and settings\n - Analyze current build times and output sizes\n - Map the complete build pipeline and dependencies\n\n2. **Performance Baseline**\n - Measure current build times for different scenarios:\n - Clean build (from scratch)\n - Incremental build (with cache)\n - Development vs production builds\n - Document bundle sizes and asset sizes\n - Identify the slowest parts of the build process\n\n3. **Dependency Optimization**\n - Analyze build dependencies and their impact\n - Remove unused dependencies from build process\n - Update build tools to latest stable versions\n - Consider alternative, faster build tools\n\n4. **Caching Strategy**\n - Enable and optimize build caching\n - Configure persistent cache for CI/CD\n - Set up shared cache for team development\n - Implement incremental compilation where possible\n\n5. **Bundle Analysis**\n - Analyze bundle composition and sizes\n - Identify large dependencies and duplicates\n - Use bundle analyzers specific to your build tool\n - Look for opportunities to split bundles\n\n6. **Code Splitting and Lazy Loading**\n - Implement dynamic imports and code splitting\n - Set up route-based splitting for SPAs\n - Configure vendor chunk separation\n - Optimize chunk sizes and loading strategies\n\n7. **Asset Optimization**\n - Optimize images (compression, format conversion, lazy loading)\n - Minify CSS and JavaScript\n - Configure tree shaking to remove dead code\n - Implement asset compression (gzip, brotli)\n\n8. **Development Build Optimization**\n - Enable fast refresh/hot reloading\n - Use development-specific optimizations\n - Configure source maps for better debugging\n - Optimize development server settings\n\n9. **Production Build Optimization**\n - Enable all production optimizations\n - Configure dead code elimination\n - Set up proper minification and compression\n - Optimize for smaller bundle sizes\n\n10. **Parallel Processing**\n - Enable parallel processing where supported\n - Configure worker threads for build tasks\n - Optimize for multi-core systems\n - Use parallel compilation for TypeScript/Babel\n\n11. **File System Optimization**\n - Optimize file watching and polling\n - Configure proper include/exclude patterns\n - Use efficient file loaders and processors\n - Minimize file I/O operations\n\n12. **CI/CD Build Optimization**\n - Optimize CI build environments and resources\n - Implement proper caching strategies for CI\n - Use build matrices efficiently\n - Configure parallel CI jobs where beneficial\n\n13. **Memory Usage Optimization**\n - Monitor and optimize memory usage during builds\n - Configure heap sizes for build tools\n - Identify and fix memory leaks in build process\n - Use memory-efficient compilation options\n\n14. **Output Optimization**\n - Configure compression and encoding\n - Optimize file naming and hashing strategies\n - Set up proper asset manifests\n - Implement efficient asset serving\n\n15. **Monitoring and Profiling**\n - Set up build time monitoring\n - Use build profiling tools to identify bottlenecks\n - Track bundle size changes over time\n - Monitor build performance regressions\n\n16. **Tool-Specific Optimizations**\n \n **For Webpack:**\n - Configure optimization.splitChunks\n - Use thread-loader for parallel processing\n - Enable optimization.usedExports for tree shaking\n - Configure resolve.modules and resolve.extensions\n\n **For Vite:**\n - Configure build.rollupOptions\n - Use esbuild for faster transpilation\n - Optimize dependency pre-bundling\n - Configure build.chunkSizeWarningLimit\n\n **For TypeScript:**\n - Use incremental compilation\n - Configure project references\n - Optimize tsconfig.json settings\n - Use skipLibCheck when appropriate\n\n17. **Environment-Specific Configuration**\n - Separate development and production configurations\n - Use environment variables for build optimization\n - Configure feature flags for conditional builds\n - Optimize for target environments\n\n18. **Testing Build Optimizations**\n - Test build outputs for correctness\n - Verify all optimizations work in target environments\n - Check for any breaking changes from optimizations\n - Measure and document performance improvements\n\n19. **Documentation and Maintenance**\n - Document all optimization changes and their impact\n - Create build performance monitoring dashboard\n - Set up alerts for build performance regressions\n - Regular review and updates of build configuration\n\nFocus on the optimizations that provide the biggest impact for your specific project and team workflow. Always measure before and after to quantify improvements."}