Native modules work, but shipping hundreds of unbundled files means hundreds of requests and a deep dependency waterfall, which is slow even over HTTP/2. Bundling gives you tree shaking, minification, code splitting per route, content hashed filenames for long cache lifetimes and a place to transform TypeScript and JSX. Dev servers now serve native modules for instant startup, then bundle for production, which is the best of both.
Why interviewers ask this
The interviewer wants to know whether you understand your toolchain or inherited a config you are afraid to touch. Explaining the dev versus production split, tree shaking requirements and code splitting boundaries shows you can debug a build rather than only run it. It also leads naturally into bundle size discipline, which is where frontend performance is usually won or lost.
How to structure your answer
- Answer the why directly: request waterfalls and cache strategy.
- List what bundling buys beyond concatenation.
- Describe the dev versus production split in modern tools.
- Say how you decide where to split chunks.
Example answer
Native modules are genuinely usable now, but the moment I have a real dependency tree I am asking the browser to discover and fetch hundreds of small files in a waterfall, and each level of the graph costs another round trip. Bundling collapses that. It also gives me tree shaking, so unused exports never ship, minification, content hashed filenames so I can cache assets for a year, and a single place to compile TypeScript. In development I use a server that serves native ES modules and transforms on demand, so startup is instant regardless of project size, then produce a rolled up build for production. For splitting, I split per route by default, plus lazy boundaries around anything heavy that is not needed for first render, like a rich text editor or a charting library. And I keep a size budget in CI that fails the build past a threshold, because bundle size only ever regresses one small dependency at a time, and by the time it is obvious it is a project rather than a fix.
Walking into this interview soon? GhostPilot listens to your live call, spots the question the moment it is asked, and puts a structured answer on your screen in real time. Try it on your next mock, or grab a $29 Session Pass, no subscription, for the real thing.
See how it worksFollow-up questions to expect
- What stops tree shaking from working on a dependency?
- How do you decide what belongs in a shared chunk?
- What do you check first when a production build behaves differently from dev?
Related frontend developer questions
Your interviewer will ask their own version of this. Paste your actual job description into the free Question Predictor and get the 20 questions that role is most likely to ask, with what each one is really probing.
Predict my questions