发布新的 Vue 应用程序版本时如何强制清除 chrome 中的缓存 [英] how to force clearing cache in chrome when release new Vue app version

查看:44
本文介绍了发布新的 Vue 应用程序版本时如何强制清除 chrome 中的缓存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 vue-cli 创建了一个应用程序,然后我构建了 dist 文件夹用于生产.

I created an app with vue-cli and then I build the dist folder for production.

该应用程序部署在 IIS 上,使用 Flask 后端并且运行良好.

The app is deployed on IIS with flask backend and works fine.

当我必须进行一些更改并且必须重做部署时,就会出现问题.此后,用户打电话给我,因为应用程序无法运行,但如果我清除了 chrome 缓存,应用程序又可以正常工作了.

The problem occurs when I have to make some changes and I have to redo the deployment. After this, users call me because app doesn't work but if I clear the chrome cache, the app works fine again.

我该如何解决这个问题?当我发布新的应用程序版本时,是否有自动清除chrome缓存的方法?

How can I fix this problem? Is there a method to clear chrome cache automatically when I release a new application version?

谢谢

我的 dist 文件夹

my dist folder

部署:在IIS上复制粘贴文件夹dist

deployment: copy and paste folder dist on IIS

如果dist文件夹中的文件正确,可能是axios缓存的问题?我也做了一些改变来休息 api

if files in dist folder are correct, maybe the problem is in axios cache? i have make some changes also to rest apis

推荐答案

我遇到了同样的问题,并在运行 build 命令修复它之前更改(增加)package.json 中的版本号.

I had the same problem and changing (incrementing) the version number in package.json before running the build command fixed it.

例如默认版本号设置为"0.1.0"

package.json 文件:

package.json file:

{
  "name": "project-name",
  "version": "0.1.5",
  "private": true,
  ...
}

这篇关于发布新的 Vue 应用程序版本时如何强制清除 chrome 中的缓存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆