FlashcardNot attempted
Who controls caching
Recall it before you reveal
Caching of JS chunks involves the bundler, the server/CDN and the browser. What does each one control?
Space to reveal
Show answer & explanation
- Bundler (Vite/Rollup, webpack): the file names (content hash: Vite does it by default, webpack via
[contenthash]) and how code is split into chunks. It doesn't cache anything itself. - Server / CDN: the `Cache-Control` header sent with each response (e.g.
vercel.jsonheaders, nginxadd_header, S3 object metadata) and how long its own edge copies live. - Browser: actually stores responses (memory or disk cache) and obeys the headers. You can't choose where it stores them, and it may evict them early under storage pressure.
So: the bundler makes URLs safe to cache, the header turns caching on.