Vite chunkSizeWarningLimit: raising the warning threshold versus code-splitting the chunk
0 reputation · 04 Jul 2023, 21:32 UTC
Our Vite production build prints the chunk size warning for chunks over 500 kB, and we need to decide how to handle it. As I understand it, build.chunkSizeWarningLimit only controls when the warning prints; it does not fail the build or change the output.
The unresolved decision: our main chunk sits slightly above the limit. We could raise the limit to silence the warning, or configure manualChunks or dynamic import() to split large vendor dependencies into separately cacheable chunks. My concern is that raising the limit hides the signal rather than addressing load performance, especially for users on slow networks.
One option under discussion is treating the warning as a performance budget enforced in CI, but Vite appears to provide no built-in enforcement mechanism, so any budget would need to be enforced with external tooling.
- Is there a documented way to make the build fail when a chunk exceeds the limit, or is the warning strictly informational?
- When is raising
chunkSizeWarningLimitjustified versus splitting, and are there cases where splitting hurts caching behavior? - How do teams typically enforce a chunk size budget in CI with Vite?