question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

PWA Mode: Unable to exclude html from caching due to navigateFallback change

See original GitHub issue

Hello!

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:closed
  • Created 3 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
rstoenescucommented, May 16, 2020

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

1reaction
jean-moldovancommented, May 15, 2020

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:

workbox.routing.registerNavigationRoute(workbox.precaching.getCacheKeyForURL("/index.html"), {
  whitelist: [],  
});

Let’s review our options. Thanks again.

Related: https://github.com/GoogleChrome/workbox/issues/1767#issuecomment-553695250

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found