
contenthash,通过 CDN 分发Nginx,index.html 与静态资源均设置了缓存,但未做差异化Uncaught SyntaxError、某个 chunk 未定义index.html 与脚本的 Cache-Control、ETag、Last-Modifiedindex.htmlindex.html 被设置了较长 TTL(例如 Cache-Control: public, max-age=600),导致页面入口在浏览器与 CDN 均被缓存index.html 引用新的带指纹的静态资源,而部分用户仍持有旧 index.html,请求旧的 chunk 路径出现 404ETag 与 If-None-Match 不匹配,弱校验未生效index.html 与关键入口路径,并对旧版本引用的资源做临时回滚或补齐curl -I 返回头部,验证是否已改为不缓存入口和长期缓存静态index.htmllocation = /index.html {
add_header Cache-Control "no-cache, no-store, must-revalidate";
add_header Pragma "no-cache";
add_header Expires "0";
}location /static/ {
expires 1y;
add_header Cache-Control "public, max-age=31536000, immutable";
}output.filename = "js/[name].[contenthash:8].js"
output.chunkFilename = "js/[name].[contenthash:8].chunk.js"index.html 不缓存或极短 TTL;静态资源长期缓存加 immutablecurl -I 验证步骤index.html 是否返回 no-cache, no-store, must-revalidatepublic, max-age=31536000, immutableindex.html 引用路径,确认不会出现 404 或版本错配index.html 并正确激活