How to Version dist files to avoid browser cache?


#1

How to avoid browser cache files in a Ionic 3 application? Every time I deploy a new version, I need to clear browser cache or open in anonymous window…

In angular I use to use the plugin gulp-useref to add a ?v=x.x.x, forcing the browser to download the updated file…

So, how to do it in Ionic 3? Is there another way to do it?


#2

will this work?

<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Expires" content="0" />

#3

But this way, all content will not be cached, right?
Would be better if the browser could cache the files, but update the files when a new version is deployed…


#4

Hi,

did you allready find a solution?

I think it should be something like File-Fingerprinting or use of ETag (but this needs extra server-roundtrip) controlled by some version-variable.

Does anybody know of a working solution for this?

thanks
marc


#5

See:


#6

thanks, will have a look at this!


#7

Hi! Did you find a solution? I have the same question. Thanks!


#8

Many thanks, Useful Guides