更新旧代码的缓存问题
我对NUXT JS所做的所有JS缓存感到非常烦人和交易中断问题,除非用户手动清除网站的浏览器缓存,否则所有代码都被执行时被执行,并且没有在网站上执行!
我搜索了可以自动删除卡车的解决方案,但找不到这种解决方案。 现在,我最近升级了我的网站,并将get
method axios命令更改为post
,但是每当我或其他任何人打开网站时,它都会通过旧获取方法获取数据并丢弃错误除非您手动清除缓存。
我在完全更改网站的UI时遇到了同样的问题,并且在您输入网站时会显示旧的代码,例如显示一些在新代码中完全删除的内容,但除非我清除caches,否则不会消失。
是否有解决这些问题的解决方案?
I'm having extremely annoying and deal breaker issues with all the js caching that nuxt js does, all the codes get executed as they were cached before and not being implemented on website unless the user clears the browser cache for the website manually!
I searched for solutions to delete caches automatically and didn't found such solution.
now I have recently upgraded my website and changed a get
method axios command to post
but whenever I or anyone else opens the website it gets the data via old get method and throwing errors unless you clear caches manually.
I had same issues before when changing UI of website completely and it showing old codes when you enter website, like showing some content which are completely removed in new code but not disappering unless I clear caches.
is there any solutions to get around these kind of problems?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我最近为这个问题建立了一个解决方案,似乎运行良好。
创建以下插件:
将插件添加到NUXT:
此插件在推动更新后迫使该应用程序重新加载。除此之外,我建议您在
package.json.json
中更改版本
属性。希望这有帮助!
来源:
I have recently founded a solution for this problem that seems to be working well.
Create the following plugin:
Add the plugin to Nuxt:
This plugin forces the app to reload after an update is pushed. Other than this I suggest that you change the
version
property in yourpackage.json
each time you want to push a new update.Hope this helps!
Source: Github: Nuxt community: Detect and update new builds