Open agentmilindu opened 6 years ago
My initial config was as follows,
new OfflinePlugin({
relativePaths: false,
publicPath: '/',
caches: {
main: [':rest:'],
excludes: ['.htaccess'],
additional: ['*.chunk.js'],
},
// removes warning for about `additional` section usage
safeToUseOptionalCaches: true,
AppCache: false,
}),
My current config is al follows,
new OfflinePlugin({
relativePaths: false,
publicPath: '/',
appShell: '/',
caches: {
main: [':rest:'],
excludes: ['.htaccess', '/', '/auth/login', 'index.html'],
additional: ['*.chunk.js'],
},
ServiceWorker: {
events: true,
},
// removes warning for about `additional` section usage
safeToUseOptionalCaches: true,
AppCache: false,
}),
also having this part now,
OfflinePluginRuntime.install({
onUpdateReady: () => {
console.log('ready to update from service woker');
OfflinePluginRuntime.applyUpdate();
},
onUpdated: () => {
console.log('updating from service worker');
window.location.reload(true);
},
});
@agentmilindu
Cannot see any obvious misstakes in your config, a couple of questions:
html-webpack-plugin
)?Cache-Control: no-store
).exclude
pattern exactly match or actually include the actual index
asset being served?Here are some issues that might be related:
I'm developing a product which uses this amazing Offline Plugin. But I have a little issue, most probably me messing with the configs, please help me.
Users are complaining they don't see the new versions unless they refresh the page again. I see
/
being served from service worker. In our scenario, users know the features beforehand and we need to make sure they get the latest version without asking them to refresh.I see
/
in the cache and sometimes having 2,3 versions old caches on some users. How can I exclude this from caching? We are okay with theindex
's page load time as it is a very small file, ourmain.<hash>.js
is what contains all the app contents.We want users who go to
/
get the latestindex
content which has the latestmain.<hash>.js
without refreshing. Please help us.