PWA Mode: Unable to exclude html from caching due to navigateFallback change
See original GitHub issueHello!
In my app I do not want the html files to be cached by the Service Worker:
workboxPluginMode: 'GenerateSW',
workboxOptions: {
exclude: [/\.html$/]
},
Looks like the recent change https://github.com/quasarframework/quasar/commit/b646fd6b6d79808b13d7d417c31e82c3bb32aba6 defaults workbox navigateFallback to ‘index.html’.
This does not work correctly when attempting to exclude html files, see https://github.com/GoogleChrome/workbox/issues/1576#issuecomment-408162957
Maybe Quasar should not be assigning navigateFallback by deafult? Is there a way to remove navigateFallback from the workbox options when generating SW file?
Thanks!
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
workbox-webpack-plugin - Chrome Developers
GenerateSW. This class supports creating a new, ready-to-use service worker file as part of the webpack compilation process. Use an instance of GenerateSW ......
Read more >How to exclude specific pages from caching in PWA?
var cacheExclude = [ '/user/register', '/item/new', '/login' ];. I want when these pages are accessed offline the '/offline.html' should be ...
Read more >Quasarians in Action #30. With Staff Pick of the Week!
Eugene Granik reported the issue PWA Mode: Unable to exclude html from caching due to navigateFallback change which was fixed by a ...
Read more >3. Precaching and basic offline mode - PWA Workshop
When offline, some non-essential static files can not be downloaded and have not been put in cache ; for example, the PWA logo...
Read more >Workbox Module - Nuxt PWA
You can enable debug mode using workbox.config.debug for production to debug. ... (Array) Cache a set of files when registering service worker.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
With future “@quasar/app” v1.8.7 you’ll be able to set navigateFallback to false which will completely disable this feature.
However, I think that what you actually want is described here: https://quasar.dev/quasar-cli/developing-pwa/configuring-pwa#Reload-%26-Update-Automatically
Hi, thanks for reopening this issue. I kind of get the idea of Quasar defaulting to index.html, so that users don’t have to configure it manually.
In case you want to ignore certain urls, you can do:
navigateFallbackBlacklist: [url] // Workbox v4
In case you want to disable navigationFallback completely, you can do:
navigateFallbackWhitelist: []
Even though it’ll result in a bit of a dodgy piece of code in your sw, it’ll do the job:Let’s review our options. Thanks again.
Related: https://github.com/GoogleChrome/workbox/issues/1767#issuecomment-553695250