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.
Symptom
- `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` returns `Cache-Control: public, max-age=86400`
- Repeated refreshes sometimes succeed, and different CDN nodes return different `ETag` values for the same HTML
Checklist
- Inspect the `Cache-Control` response header on `index.html`
- Compare the chunk filename referenced by the CDN HTML with the files present on the origin
- Request the same HTML through different regional nodes and compare `ETag` and body
- Check whether the release process deletes the previous version's `js/` directory
- 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
- Giving `index.html` a long `max-age` for performance, which guarantees old HTML can reference deleted chunks
- Purging the CDN on release but not the browsers: already-cached HTML keeps requesting the removed chunk
English edition written for Atlaslog from the original Chinese field note. Code is unchanged and runs as-is.
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).