Optimize Bundle Size
Reduce and optimize bundle sizes through analysis, configuration, and code splitting strategies
$ npx claude-code-templates@latest --command="performance/optimize-bundle-size" --yesRequires Claude Code. The command adds this command to your project's .claudedirectory — nothing runs on ToolZip's servers.
What's inside this command
Component source
Optimize Bundle Size
Reduce and optimize bundle sizes: $ARGUMENTS
Instructions
- Bundle Analysis and Assessment
- Identify large dependencies and unused code across all bundles
- Assess current build configuration and optimization settings
- Create baseline measurements for optimization tracking
- Document current performance metrics and loading times
- Build Tool Configuration
- Enable code splitting and chunk optimization features
- Configure tree shaking and dead code elimination
- Set up bundle analyzers and visualization tools
- Optimize build performance and output sizes
- Code Splitting and Lazy Loading
- Set up dynamic imports for components and modules
- Configure lazy loading for non-critical resources
- Optimize chunk sizes and loading strategies
- Implement progressive loading patterns
- Tree Shaking and Dead Code Elimination
- Mark packages as side-effect free where appropriate
- Optimize import statements for better tree shaking
- Use ES6 modules and avoid CommonJS where possible
- Implement babel plugins for automatic import optimization
- Dependency Optimization
- Replace large libraries with smaller alternatives
- Use specific imports instead of importing entire libraries
- Implement dependency deduplication strategies
- Configure external dependencies and CDN usage
- Asset Optimization
- Implement responsive image loading strategies
- Configure asset minification and compression
- Set up efficient file loaders and processors
- Optimize font loading and subsetting
- Module Federation and Micro-frontends
- Configure shared dependencies and runtime optimization
- Set up micro-frontend architecture for code sharing
- Optimize remote module loading and caching
- Implement federation performance monitoring
- Performance Monitoring and Measurement
- Configure automated bundle analysis in CI/CD
- Monitor bundle size changes over time
- Set up performance budgets and alerts
- Track loading performance metrics
- Progressive Loading Strategies
- Configure service workers for caching strategies
- Set up intersection observer for lazy loading
- Optimize critical resource loading priorities
- Implement adaptive loading based on connection speed
- Validation and Continuous Monitoring
- Configure bundle size thresholds and alerts
- Implement bundle size regression testing
- Monitor real-world loading performance
- Set up automated optimization recommendations
Focus on optimizations that provide the most significant bundle size reductions while maintaining application functionality. Always measure the impact of changes on both bundle size and runtime performance.
Related Claude Code Commands
Optimize Database Performance
Optimize database queries, indexing, and performance for improved response times and scalability
Performance Audit
Comprehensive performance audit with metrics, bottleneck identification, and optimization recommendations
Optimize Build
A ready-to-install Claude Code component.
Optimize Api Performance
Comprehensive API performance optimization with response time reduction, throughput improvement, and scalability enhancements
Implement Caching Strategy
Design and implement comprehensive caching solutions for improved performance and scalability
Optimize Memory Usage
Comprehensive memory usage optimization with leak detection, garbage collection tuning, and memory profiling
Catalog data and component content are sourced from the open-source davila7/claude-code-templates project (MIT license). ToolZip curates the listing and writes original descriptions; every component links back to its original source. Claude Code is a product of Anthropic. ToolZip is an independent catalog and is not affiliated with or endorsed by Anthropic.