Tree‑shaking vs Manual Chunks: Which Cuts Bandwidth for Low‑Traffic Pages?
0 reputation · 22 Mar 2021, 01:56 UTC
Goal
Minimize the amount of data transferred for a single page that receives a small number of visits per month.
Constraints & Uncertainty
Rollup removes unused ES module exports by default, but the extent of size reduction depends on side‑effect annotations and the presence of dynamic imports. Manual chunks can split the bundle into route‑specific pieces, increasing the HTTP request count unless served over HTTP/2. The trade‑off also varies across Rollup major versions; output.manualChunks defaults and behavior have shifted between v3 and v4.
Because the page is low‑traffic, the cost of additional requests may be negligible, yet the savings in initial payload could impact user experience on slow connections.
Unresolved Decision
It remains unclear whether the default tree‑shaking alone provides sufficient bandwidth savings, or whether manual chunking yields a measurable benefit that outweighs the extra request overhead.
Will tree‑shaking alone suffice to reduce bandwidth on a low‑traffic page, or does manual chunking provide a measurable benefit? How does the cost of additional HTTP requests balance against the savings in bundle size under HTTP/2? What Rollup version differences could affect this trade‑off?