-
-
Notifications
You must be signed in to change notification settings - Fork 292
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
clear cache on current users' device in migrating from webpack 3 to 4 #457
Comments
@mjseyyedi I can see that you solved your own issue reading your SO question - great! :) I sent a PR adding info regarding this, #459, if you have the time, please check it out |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi.
first of all, thanks for your great plugin.
but then, I asked this question in stackoverflow but nobody answered. the problem is that, when I convert webpack 3 to 4, new service worker cannot detect file changes and clearing cache would not execute. so previous files are still applying. could you help me to find a way in which I could apply changes to new version.
here is my offline-plugin config:
new OfflinePlugin({ relativePaths: false, publicPath: '/', excludes: ['.htaccess'], caches: { main: [], optional: [':rest:'], }, safeToUseOptionalCaches: true, AppCache: false, responseStrategy: 'cache-first', autoUpdate: 1000 * 60 * 60 * 1, appShell:'/index.template.html', ServiceWorker: { output: 'service-worker.js', events: true, prefetchRequest: { credentials: 'include', mode: 'cors' } }, cacheMaps:[ { matchPath: [/^\/\w+\.html$/], to: '/', requestType: ['navigate'] }, ] }),
and this is my updating peace of code:
const runtime = require('offline-plugin/runtime'); runtime.install({ onUpdating: () => { console.log('SW Event:', 'onUpdating'); }, onUpdateReady: () => { console.log('SW Event:', 'onUpdateReady'); runtime.applyUpdate(); }, onUpdated: () => { console.log('SW Event:', 'onUpdated'); window.location.reload(); }, onUpdateFailed: () => { console.log('SW Event:', 'onUpdateFailed'); } });
The text was updated successfully, but these errors were encountered: