Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
264 views
in Technique[技术] by (71.8m points)

react项目中index.html文件被缓存下来了

在开发react后,打包生成了dist包,发布到线上后,因为html中css和js文件的hash值已经改变了,但浏览器依然是使用的缓存的html文件,导致资源文件请求失败报错。
想问一下有什么办法可以解决这个问题吗?
image.png


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

我们公司的项目通常在网站加载index.html时在url query加上版本号,每次更新代码后同时更新版本号。


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...