vite-plugin-pwa: navigateFallbackDenylist is not working with generateSW Strategy

Hi I want to exclude contents of locales folder completely from getting pre-cached however thats not working. And similarly the runtime cache for locales folder also doesn’t work.

The locales folder is inside src/locales/*.json and I want to avoid precaching locales folder, however even after adding to navigateFallbackDenylist it still gets pre-cached under assets.

Screenshot 2023-07-11 at 1 49 48 PM

This is how I do it 👇🏻

navigateFallbackDenylist: [new RegExp("locales/[^/]+.json")]

Is this because locales are not inside public folder but src ? However since I am using it in code to import so I cannot move it outside src folder.

Please let me know how can I fix this If I want to use generateSW strategy

About this issue

  • Original URL
  • State: open
  • Created a year ago
  • Comments: 58 (35 by maintainers)

Most upvoted comments

looks like the above strategy is working and first load + offline issue seems to be resolved https://excalidraw-9xup84w1r-excalidraw.vercel.app/

@userquin I was able to resolve the remaining issues with what you suggested ✨

  1. Locales folder is now nested inside assets with rollup build
  2. Locales cache is also created separately - however in chrome I don’t see it getting updated when more langs are added but in other browser eg firefox it does and it works offline too in both so I think some caching issue with my chrome but offline behaviour is as expected so thats great
  3. fonts.css is also now cached inside fonts cache after glob ignore.

Thanks a ton ❤️