Basic Configuration
webpack.config.js
Performance Options
Configure performance hints or disable them.
Control how performance hints are displayed.Default:
'warning' in production, false in developmentMaximum size (in bytes) for individual assets.Default:
250000 (244 KiB)Files exceeding this limit will trigger a warning/error.Maximum size (in bytes) for entry point assets.Default:
250000 (244 KiB)The combined size of all assets for an entry point that exceed this limit will trigger a warning/error.Filter which assets should be considered for performance hints.Default: Only considers assets ending with
.js or .cssUnderstanding Limits
Asset Size
Individual file size limit:assetFilter.
Entry Point Size
Total size of all assets for an entry point:Common Configurations
Development (Disabled)
webpack.dev.js
Production (Warnings)
webpack.prod.js
Strict Production (Errors)
webpack.prod.js
Large Application
webpack.config.js
Custom Asset Filter
Only check JavaScript bundles:webpack.config.js
webpack.config.js
Size Units Reference
Environment-Based Configuration
webpack.config.js
Performance Budgets Strategy
Progressive Enhancement
Start strict and loosen if needed:Different Budgets per Entry
Use multiple configurations:webpack.config.js
Best Practices
1. Set Realistic Limits
Based on your target users and network conditions:2. Monitor Trends
Track bundle size over time:3. Code Splitting
Reduce entry point size:4. Tree Shaking
Remove unused code:5. Dynamic Imports
Lazy load features:Handling Warnings
When you see performance warnings:Solutions:
-
Analyze the bundle:
-
Split chunks:
-
Dynamic imports:
-
Tree shaking:
-
Compression:
-
Increase limits (last resort):
CI/CD Integration
Fail builds that exceed budgets:webpack.prod.js