0

I am using create-react-app that includes sw-precache-webpack-plugin i also config cacheId in webpack.config.prod, i noticed webpack generate news files and filenames after every build and all are stored in the same cache but the old files also continues in cache ¿what is the way to remove all not necesary files of sw cache?

1 Answers1

1

As of this moment sw-precache-webpack-plugin and sw-precache (which is used behind the scenes) don't seem to offer deleting old cache entries as per their documentation.

You can easily do it by hand if you change the cache name every time you make a new build. More on that here.

pate
  • 4,937
  • 1
  • 19
  • 25
  • The problem with this solution is that sw-precache automatically generate service worker file, ¿every time i build should override generated service-worker.js in build folder? or exists any way to do it in register-service-worker.js – cristian camilo cedeño gallego Dec 13 '17 at 11:54