Closed nwaughachukwuma closed 6 years ago
Does this happen even with a freshly install project using this template?
@MaxMilton I have not inspected it. Will do that soon enough. But what do you think the problem might be
Hi @jeffposnick, thanks for quick reply. I will give my answer in the order you have asked them:
You can access the platform here: https://dashboards.dprsconnect.org.ng/ All you need to do is revisit the platform after a period of inactivity, don't know how to quantify this really. But say you put off your internet, and hibernate your system or put in sleep mode for a while. When you put it back on, revisit the URL with the internet off. That might reproduce it.
No, this is not the situation. I had it deployed once and didn't redeploy in between visits.
I didn't see the corresponding js File. However it is generated in the dist folder. Please check following link to see the full content of the generated service worker file: https://pastebin.com/Ck3AvhZn.
I hope my response is detailed enough. Thanks so much
The problem is that your vendor bundle is 7.5 megabytes, and by default sw-precache
won't cache anything larger than 2 megabytes. So your vendor bundle isn't available offline. And then when you immediately visit your web app right after waking up a system from sleep, you're effectively offline (if you reload quickly enough, before your WiFi connection has reestablished). I could simulate the same error just by forcing offline mode in Chrome's DevTools and then reloading the page.
You've got a few options:
maximumFileSizeToCacheInBytes
config option that's passed to the SWPrecacheWebpackPlugin
config.I'd strongly suggestion that you go with the third option, since your users will really benefit from having to download and parse less JavaScript.
Thanks so much @jeffposnick your response is really helpful. What I have done is remove certain unnecessary dependencies, thus reducing the vendor.js file size to about 2 mb. And it's working perfectly now. Really grateful for this help. Thanks also @MaxMilton
Hi @jeffposnick I have noticed that running my application over https://dashboards.dprsconnect.org.ng/ still gives me over 7mb but same application over https://dhis2-daily-reporting.firebaseapp.com gives me <2mb. What could be responsible for this? As the consequence is that the former takes long to load than the later, and the behavior is also funny.
Mind you I havehad to adopt the option of increasing maximumFileSizeToCacheInBytes to about 10mb just to accommodate this behavior.
@jeffposnick , @addyosmani, @MaxMilton and everyone, my app is doing great offline thanks to this awesome template. I am really delighted about the template. But there's a little challenge. Whenever I try to visit the app after a period of inactivity, I get a blank screen (image below), and on chrome debugger, I see that it could not fetch the hashed vendor.js file. Also the vendor.js file is missing in the list of js files in the frames. And it shows an error reading the manifest.js file. This is like what is left for me to have a complete offline application. I am hoping there's a fix for this. Thanks