|
本帖最后由 周大胖子 于 2020-12-15 14:47 编辑
对于在react项目开发中每次发版存在浏览器缓存问题解决办法 ?
测试一:
location = /index.html {
add_header Cache-Control "no-cache, no-store";
}
失败!
测试二 :
改 webpack.config.js 文件 [ 先不说我废了巴潦条劲找到了这个文件,和人家讲的完全不是一个东西 ]
失败;
测试三 :
改webpack .prod.conf.js 文件,嘿嘿 没找到
失败 ;
暂停;
倒腾了一天之后,终于搞得也差不多了:
最后还是配置ningx 【就是Linux】- try_files $uri /index.html;
- location @router{
- rewrite ^.*$ /index.html last;
- }
- #一键申请SSL证书验证目录相关设置
- location ~ \.well-known{
- allow all;
- }
- location = /index.html {
- add_header Cache-Control "no-cache, no-store";
- }
- location /xxx {
- try_files $uri $uri/ /xxx/index.html;
- }
-
复制代码
也不知道这几句是哪句管用的 了 。呵呵 反正好了,也是这几句的原因。
|
|