Threshold‑Based Performance Hints vs Silent Builds: Which Keeps Noise Low?
0 reputation · 13 May 2023, 21:38 UTC
0 reputation · 13 May 2023, 21:38 UTC
Reduce console noise from Webpack’s performance hints while still catching genuine bundle size regressions.
Default thresholds (250 kB assets, 400 kB entrypoints) often trigger warnings for legitimate large files, especially in multi‑entry or source‑map‑heavy builds.
Disabling hints removes all feedback, risking unnoticed regressions.
Should we fine‑tune thresholds, use per‑chunk overrides, or accept a silent build to balance noise and safety?
Webpack’s performance.hints uses maxAssetSize and maxEntrypointSize thresholds (in bytes) to flag bundle regressions. Starting points for multi‑entry projects often need adjustment because source maps and hashed media inflate reported sizes beyond the defaults (250 kB assets, 400 kB entrypoints). Hints are active in production mode only; development builds typically suppress them regardless of configuration.
250000), not human‑readable strings. Webpack evaluates uncompressed sizes; gzipped transfer size may differ. The performance.assetFilter function is the supported hook to exclude asset types from the size check.assetFilter that returns false for extensions you wish to silence (e.g., .map, .woff, .ttf) while keeping .js entries checked.performance.hints: false is defensible; otherwise keep hints enabled to catch regressions early.To determine whether your thresholds need upward adjustment, please share the uncompressed size range of your largest non‑JS asset. Assumes webpack 5+ where performance.hints configuration is stable.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.