Staled index.html even using revision
pedrocostadev opened this issue · comments
Library Affected:
workbox-webpack-plugin
Browser & Platform:
all browsers
Issue or Feature Request Description:
I have a SPA with the following code that Injects the manifest:
const revision = new Date().getTime().toString();
...
env.plugins.append('WorkboxPlugin', new WorkboxPlugin.InjectManifest({
swSrc: path.join(root, 'frontend/app/service-worker.js'),
swDest: path.join(root, 'public/service-worker.js'),
exclude: [/\.map$/, /asset-manifest\.json$/, /LICENSE/],
additionalManifestEntries: [
{ url: '/index.html', revision },
{ url: 'https://fonts.googleapis.com/css2?family=Manrope:wght@300;400;500;700&display=swap', revision },
],
maximumFileSizeToCacheInBytes: 50 * 1024 * 1024,
}));
As you can see, there is a revision and if I inspect the cache I can see it there:
On the SW side, I have this code too:
const indexNavigationRoute = new NavigationRoute(createHandlerBoundToURL('/index.html'), {
denylist: [
new RegExp('/service-worker.js'),
new RegExp('.*/manifest.json'),
new RegExp('/404.html'),
new RegExp('/422.html'),
new RegExp('/500.html'),
new RegExp('/privacy'),
],
});
The issue is that the index.html file has the scripts for the JS chunks but even using the revision the browser is using a staled version. Any idea how to fix this?