vite-plugin-pwa: Cached files does not load pages except "/" (base path) in sveltekit

My problem is related to the cached files. If I route to the main page, which is / everything works fine. However, if I want to route another page, such as

  • /explore
  • /posts/x
  • /users/y

These page assets are loading from the current path not from the base path. Therefore, non of the files be able to uploaded and the page doesn’t respond correctly.

Some project information may be helpful for finding solution.

  • I have defined scope and base as / both in manifest and SvelteKitPWA config.
  • I use generateSW strategy with autoUpdate register type
  • I don’t have custom service worker.

If you need any further information, please let me know.

Also, here is the a part of error in browser console. If I do hard refresh on page, everything works fine.

image

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 29 (18 by maintainers)

Most upvoted comments

try setting paths.relative to false in kit config file: https://kit.svelte.dev/docs/configuration#paths