简体   繁体   English

Vue.js 清除用户缓存

[英]Vue.js clear user cache

I'am deploying a new app version of my Vue.js SPA and got the problem that it's only loads if I clear my cache.我正在部署我的 Vue.js SPA 的新应用程序版本,但遇到的问题是它只有在我清除缓存时才加载。 So for me this is fine but the customers won't get it.所以对我来说这很好,但客户不会得到它。 Is there a workaround to check the version and force the browser to reload my page?是否有解决方法来检查版本并强制浏览器重新加载我的页面? My Setup is:我的设置是:

  • SPA created with latest Vue CLI SPA 使用最新的 Vue CLI 创建
  • Vue Bootstrap Vue 引导程序
  • Bundled with Webpack与 Webpack 捆绑
  • Hosted in AWS S3 Bucket托管在 AWS S3 存储桶中

Best regards.此致。

Maybe it helps somebody.也许它可以帮助某人。

I figured out some things.我想通了一些事情。 First there seems to be a problem with the cli, after some time the file hashing worked again (maybe a update or just a simple clean install).首先,cli 似乎有问题,一段时间后文件散列再次起作用(可能是更新或只是简单的全新安装)。 Second, I'am using aws cloudfront to provide my application, cloudfront caches your site on its endpoints.其次,我使用aws cloudfront来提供我的应用程序,cloudfront 将您的站点缓存在其端点上。 So I have to invalidate my cloudfront using所以我必须使用

aws cloudfront create-invalidation --distribution-id YOUR_DISTRIBUTION_ID --paths '/*' --profile YOUR_PROFILE >/dev/null

So everybody got the new page after refreshing.所以大家刷新后都得到了新的页面。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM