Frontend Architecture
Build pipelines: multiple-choice review
Six questions that cut across the whole unit. Each one mirrors a call you make while a bundle regresses, a dev-only bug ships, or a build step times out CI — not a definition to recite, but a tradeoff to weigh.
Confirm you can connect the five pipeline stages, why tree-shaking fails, why dev and prod diverge, and how content hashing and tool choice trade off — the synthesis the overview built toward.
A teammate swaps import debounce from 'lodash/debounce' for import _ from 'lodash' and the main bundle grows ~200 KB. Why did tree-shaking not drop the unused functions?
A clean ESM utility library still ships dead code after bundling, even though every import looks unused. The most likely cause?
A feature works in the Vite dev server but breaks after vite build. What is the most likely structural cause, not a one-off?
Why does swapping Babel for esbuild or SWC cut the transform stage by 90%-plus, while the bundle stage rarely sees the same speedup?
Returning users re-download the large vendor chunk on every app deploy even though React and your deps never changed. The fix?
Source is clean ESM, yet the prod bundle still ships an entire dependency it should have shaken. The transform stage is the suspect — why?
The through-line: a build is resolve → transform → bundle → minify → emit, and the seams between stages are where bugs live. Tree-shaking needs static ESM, so it is defeated by CommonJS, by undeclared side effects, and by transforms that down-level ESM to CJS before the bundler looks. Transform is parallel (so compiled tools win there) while bundle stays serial. Dev and prod run different tools, so validate the real prod build. And content hashing only pays off if you split stable vendor code from churny app code.