Course contentsShow
← React
Lesson 1426 of 2,39635. Code SplittingFree lesson

The Cost of Over-Splitting

Recognize diminishing returns: too many chunks create overhead from increased HTTP requests and parsing.

The Cost of Over-Splitting

What you'll learn: Why creating too many small code-split chunks can actually hurt performance instead of helping it.


You've learned how code splitting reduces bundle sizes, but there's a hidden trap: splitting too aggressively creates more problems than it solves.

Understanding the Overhead

Every code-split chunk requires:

  • An additional HTTP request to fetch it
  • Parsing and evaluation time by the JavaScript engine
  • Network negotiation overhead (DNS lookup, connection, headers)

When you split a 2KB component into its own chunk, you might save 2KB from the initial bundle—but the browser now makes an extra request that adds ~50-100ms of latency. For small chunks, the overhead costs more than the savings.

The Diminishing Returns

Think of it like this: imagine organizing your kitchen by putting each individual spice in a separate locked cabinet across your house. Yes, your main counter is clear, but now cooking takes forever because you're constantly walking back and forth. The overhead of retrieval outweighs the benefit of organization.

Similarly, 50 tiny chunks of 2-5KB each creates:

  • 50 separate network requests (even with HTTP/2 multiplexing)
  • 50 separate parse/eval cycles
  • Increased complexity in debugging and caching
  • Potential loading "waterfalls" where chunks load sequentially

Finding the Balance

The sweet spot you learned earlier—route-level splitting—exists precisely because routes naturally create 20-50KB+ chunks. That size justifies the request overhead. Component-level splitting only makes sense for large, optional features (like a rich text editor or chart library), not every small component.

Key Takeaway: Code splitting has overhead costs; only split when chunk sizes are large enough (typically 20KB+) to justify the additional HTTP request and parsing time.