A bundle is the JavaScript your build tool packages and ships to the browser. It grows mainly from dependencies, duplicated code, and shipping code the page doesn't need yet.
A bundle is the JavaScript your build tool packages and ships to the browser. It grows mainly from dependencies, duplicated code, and shipping code the page doesn't need yet.
lodash for one function pulls in the whole thing.import _ from "lodash"; // ~70KB — the entire library
import debounce from "lodash/debounce"; // ~2KB — just the function you need
Bytes are the small problem; parsing and executing JS is the big one. The browser must download, then parse, compile, and run every byte on the main thread — and that's much slower on a mid-range phone than on a laptop. Heavy JS delays interactivity and directly worsens INP and LCP.
"Just add the library" is how apps quietly become slow. Interviewers want to see you think about cost per dependency and reach for per-function imports, tree shaking, and code splitting before the bundle balloons — especially since your users' phones are far weaker than your dev machine.
A library of IT interview questions with detailed answers — from Junior to Senior.
Donate