-
-
Notifications
You must be signed in to change notification settings - Fork 295
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
Never hitting to the server #63
Comments
Hi @burakcan. First of all, in your case SW can control only Second thing is that SW doesn't update on refresh. It updates actually, but new SW doesn't take control of webpages unless you force it to do so or close all active tabs. Third thing might be that I never tried this plugonv with webpack2, so everything might be broken with it. |
Hi @NekR , thank you for the response; Im trying on both localhost:port and local.localdomain.com:port, it's working :) Yes, i'm aware that the sw doesn't take control unless all tabs are closed. But doing that doesn't help too. There's not too much change on the surface api of webpack in 2. But did try it with webpack 1.x it was the same. I'll try with a flat file structure by removing the /offfline/ path. |
Is it https? SW won't work there unless it's https. |
No the domain is not https, it's falling back to AppCache on that. But on localhost, service workers should work without ssl. Edit: AppCache is not updating too. |
I've just tried it with the default configuration |
@burakcan hmm.. weird. Does version/hash change when you build new version? |
@burakcan then it shouldn't work for everyone. Are you sure browser receives new SW version? e.g. it shouldn't be cached. Also |
I'm doing hot loading only in development (webpack config is separate). |
You may go to Network tab in devtools and inspect But, if your server never receives request for |
Ah sorry :) it's the cache-control header. Setting it to zero fixed. Thank you @NekR So the update scenario is like this right?:
|
@burakcan right. In latest Chromes (e.g. Canary) you can set "Update SW on every navigation" option. Very useful for development. In this case SW is downloaded before pages loads, reinstalled and then page is downloaded. Other way is apply update manually (this will work you users too): // config
new OfflinePlugin({
ServiceWorker: {
events: true
}
}) // the app
runtime.install({
onUpdating: () => {
console.log('SW Event:', 'onUpdating');
},
onUpdateReady: () => {
console.log('SW Event:', 'onUpdateReady');
// Apply update when available
runtime.applyUpdate();
},
onUpdated: () => {
console.log('SW Event:', 'onUpdated');
// Reload immediately when updated
window.location.reload();
}
}); |
Thank you so much @NekR |
Please read here about SW update process and related stuff: https://github.com/NekR/offline-plugin/blob/master/docs/updates.md |
Thanks :)
|
Hi, i'm trying to use this plugin but i couldn't get it working right.
Webpack version: 2.1.0-beta.8
Plugin version: 3.2.1
Configuration:
On the first load, everything is ok and the app works offline on the next launch. But when i update something and build again, the cache/sw won't update. Also, there's no hits in the server logs. What i'm doing wrong? Should i put the runtime call in a non-cached chunk?
The text was updated successfully, but these errors were encountered: