Question
Vite Dev (esbuild) vs Production (Rollup): Module Resolution Parity Gap
Kavi Vale
0 reputation · 29 Apr 2025, 22:47 UTC
88.9K views0
Integration Boundary: esbuild in Dev vs Rollup in Prod
The primary goal is to measure performance bottlenecks before applying optimizations. Developers often profile the dev build (esbuild) and the production build (Rollup) separately, assuming parity in module resolution, plugin execution, and CSS handling. However, Vite’s dual‑pipeline architecture introduces subtle differences that can skew bottleneck measurements.
Key Uncertainties
- esbuild resolves bare imports using Node’s algorithm with heuristics, while Rollup relies on its own resolution logic and
mainFieldsconfiguration. - Rollup‑specific plugin hooks such as
renderChunkorgenerateBundleare ignored in dev, potentially altering HMR semantics. - CSS extraction differs: esbuild inlines CSS, whereas Rollup delegates to plugins like
vite-plugin-css, affecting asset hashing and cache invalidation.
Unresolved Decision Points
- Should Vite adopt a unified bundler (e.g., Rolldown) to eliminate parity gaps, or maintain separate pipelines?
- How significant is the impact of dev‑only errors (e.g., unsupported CommonJS dynamic requires) on production bundle size and runtime?
- What tooling or configuration would best enable cross‑correlation of dev and prod profiling data?