Atlaslog
Atlaslog / Field Notes / Build & deployment
Field note · Build & deployment

White screen for some users after a release: ChunkLoadError

Quick answer

Ten minutes after a deploy, some users see a blank page while others load normally, and clearing the cache fixes it. The cached `index.html` still points at a hashed chunk that was deleted on the origin, so the lazy chunk 404s on the CDN.

Last verified 2026-11-03 · Multiple versions · Cite this page
Applies to: webpack 5.94 / CDN
Symptom
Checklist
  1. Inspect the `Cache-Control` response header on `index.html`
  2. Compare the chunk filename referenced by the CDN HTML with the files present on the origin
  3. Request the same HTML through different regional nodes and compare `ETag` and body
  4. Check whether the release process deletes the previous version's `js/` directory
  5. Reproduce by loading a stale `index.html` from disk cache
Fix

Serve `index.html` with `Cache-Control: no-store, no-cache, must-revalidate` and keep hashed assets at `public, max-age=31536000, immutable`; retain one or two previous release directories and reload once on `ChunkLoadError`, guarded by a `sessionStorage` flag.

Code
Uncaught ChunkLoadError: Loading chunk 12 failed.
(missing: https://cdn.example.cn/gis/js/12.8a4f1c2e.js)
    at __webpack_require__.e (bootstrap:64)
curl -I https://cdn.example.cn/gis/index.html
# Cache-Control: public, max-age=86400   ← HTML 被缓存一天,问题根源

curl -s https://cdn.example.cn/gis/index.html | grep -o 'js/[0-9a-f]*\.js'
Watch out
All 120 field notesChinese originalRunnable examples
English edition written for Atlaslog from the original Chinese field note. Code is unchanged and runs as-is.
Cite this page

Atlaslog (2026). White screen for some users after a release: ChunkLoadError. https://www.jingweizhi.com/en/cookbook/cdn-static-cache.html (accessed 2026-11-03).