BACK TO DIRECTORY
hookintermediate
Bundle Size Check
Analyzes the production build output and compares bundle sizes against configured limits. Warns or blocks commits that cause significant bundle size increases, helping prevent performance regressions from large dependency additions. Shows a breakdown of which chunks grew and by how much, making it easy to identify the cause.
345 STARS
4.9k DOWNLOADS
claude-templates
bundlesizeperformancewebpackbuild
CONFIGURATION
json
1{2 "hooks": {3 "pre-push": {4 "command": "node scripts/check-bundle-size.js",5 "description": "Check that bundle size stays within limits",6 "on_failure": "warn",7 "timeout": 1800008 }9 },10 "bundle_limits": {11 "total_max_kb": 500,12 "per_chunk_max_kb": 200,13 "increase_threshold_percent": 10,14 "critical_increase_percent": 2515 },16 "analysis_config": {17 "build_command": "next build",18 "output_dir": ".next",19 "analyze_chunks": true,20 "track_dependencies": true,21 "ignore_patterns": [22 "*.map",23 "*.LICENSE.txt"24 ],25 "report_format": "table",26 "save_history": true,27 "history_file": ".bundle-history.json"28 },29 "output_example": "\nBundle Size Report:\n--------------------------------------------------\nChunk | Size | Limit | Status\n--------------------------------------------------\nmain.js | 142 KB | 200 KB | OK\nvendor.js | 234 KB | 200 KB | WARN (+17%)\npages/index.js | 28 KB | 200 KB | OK\n--------------------------------------------------\nTotal | 404 KB | 500 KB | OK\n"30}