kevinmarrec / nuxt-pwa-module

⚠️ DEPRECATED ⚠️ Zero config PWA solution for Nuxt 3
MIT License
338 stars 32 forks source link

update assets route entry to include webmanifest #52

Closed userquin closed 1 year ago

userquin commented 1 year ago

You should add manifest destination (for webmanifest) in the workbox template:

  // Cache CSS, JS, and Web Worker requests with a Stale While Revalidate strategy
  registerRoute(
    ({ request }) =>
      request.destination === 'style'
        || request.destination === 'manifest' // <== ADD THIS LINE
        || request.destination === 'script'
        || request.destination === 'worker',
    new StaleWhileRevalidate({
      cacheName: 'assets',
      plugins: [
        new CacheableResponsePlugin({ statuses: [200] }),
      ],
    }),
  )
kevinmarrec commented 1 year ago

@userquin Do you have any source for this ? I don't remember what exactly it does. Is it for manifest.json ?

userquin commented 1 year ago

@kevinmarrec I guess it is for webmanifest ("manifest": The target is a manifest, so it should be the webamnifest) https://developer.mozilla.org/en-US/docs/Web/API/Request/destination

kevinmarrec commented 1 year ago

@userquin Alright, it's ok for me. This change is easy, you could easily contribute with a simple PR if you want :)

userquin commented 1 year ago

@kevinmarrec cannot run example with instructions on readme file, it seems you've changed the layout (? missing package.json) and there are a lot of errors running it from root (running example:build or example:generate cannot find example exports in package.json):

imagen

imagen