how to force clearing cache in chrome when release new Vue app version

nickb84 picture nickb84 · Jan 8, 2020 · Viewed 21.2k times · Source

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

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

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.

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

Thanks

my dist folder

enter image description here

deployment: copy and paste folder dist on IIS

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

Answer

bonusrk picture bonusrk · Jan 8, 2020

If you use vue-cli, then it has built-in webpack configs for building dist. And in fact it adds hash-names to output files. But if it was removed somehow, you can add it back to webpack config like

  output: {
    filename: '[name].[hash].bundle.js'
  }

And your app will looks like this: enter image description here

And even more, you do not need to handle how all this stuff will be added to html, coz webpack will figure it out for you.