Course contentsShow
← JavaScript
Lesson 2443 of 2,72350. JavaScript Build ToolingFree lesson

The Module Problem in Browsers

Why browsers historically couldn't load hundreds of ES modules efficiently and how HTTP/1.1 made this worse.

The Module Problem in Browsers

You'll learn: Why loading hundreds of small ES modules was historically a performance nightmare in browsers, especially over HTTP/1.1.

The Problem

When JavaScript applications grew larger, developers naturally split code into many small, reusable modules. ES modules made this pattern official with import and export. Sounds perfect, right?

The catch: Browsers must make a separate HTTP request for each module file. If your app has 200 modules, that's 200 network round-trips.

Why HTTP/1.1 Made It Worse

HTTP/1.1 had severe limitations:

  • Limited concurrent connections per domain (typically 6)
  • Head-of-line blocking — requests waited in queue
  • No multiplexing — each file tied up a connection until fully downloaded
  • Overhead per request — headers re-sent every time

The Waterfall Effect

Imagine this dependency chain:

app.js imports utils.js
utils.js imports helpers.js
helpers.js imports constants.js

The browser can't even discover helpers.js exists until it downloads and parses utils.js. Each module creates a waterfall delay, multiplying load times.

With 100+ modules over HTTP/1.1, your app could spend seconds just waiting on network round-trips, even for small files.

The Analogy

Think of HTTP/1.1 like a single-lane toll booth. Every car (module) must stop, pay (send headers), and wait for the gate. A traffic jam forms instantly. You need one big bus (bundled file) instead of 100 individual cars.

Key Takeaway: Browsers couldn't efficiently load hundreds of ES modules because HTTP/1.1's connection limits and serial nature turned each module into a costly round-trip, forcing developers to bundle code before shipping to production.