Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Only caches visited routes #24
I've been playing around with the workbox component of the pwa module for a couple of days and have got it working with my hosting environment, but I seem to have a configuration problem.
For some reason only routes that I visit are being cached and then available offline. As far as I am concerned, this is not offline support as trying to navigate to other routes produces a browser error page.
This is strange, as in the sw.js file I can see that all of the nuxt js files for each route are being precached. However, trying to navigate to a route that I didn't visit while online gives the standard browser error (even though the corresponding nuxt js file is cached).
Is this the expected behaviour or is my configuration incorrect?
@pi0 - I looked at the PR and I don't think it fixes the issue described here:
With the PR #59 you can now disable runtime caching completely, so NO route is cached (only nuxt resources are cached).
I think what this issues needs is to have ALL available routes be part of the precache.
Therefore I vote for re-opening this issue.
added a commit
Apr 4, 2018
I tested this again and to me it seems that the behaviour changed in the latest releases and it seems that the issue is now resolved and can be closed.
Tested with: Nuxt 2.0.0 and @nuxtjs/pwa 2.6.0
The default behavior is now as follows:
To make my app work fully in offline mode, I added the following:
My configuration now looks like this:
If you don't set
When I test this, a page previously not visited will return the contents, as the Nuxt fallback page will display the correct contents. If the page does not exist, Nuxt will evaluate the routes and show the 404 page design.