Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

audoUpdate takes like 10 seconds and a refresh to work #627

Open
erfanrhb opened this issue Dec 20, 2023 · 1 comment
Open

audoUpdate takes like 10 seconds and a refresh to work #627

erfanrhb opened this issue Dec 20, 2023 · 1 comment

Comments

@erfanrhb
Copy link

erfanrhb commented Dec 20, 2023

Every time I deploy using Pnpm build command, my app dosen't automatically clear cache itself and it will take some while(usually 10 to 15 seconds) and a normal refresh to work. sometimes I have to press CTRL+F5 in my browser to make it work.
how can I fix that?

 VitePWA({
      base: '/',
      registerType: 'autoUpdate',
      workbox: {
        cleanupOutdatedCaches: true
      },
      includeAssets: ['favicon.svg', 'favicon.ico', 'robots.txt', 'apple-touch-icon.png'],
      manifest: {
        name: 'MyApp',
        short_name: 'MyApp',
        start_url: '/?utm_source=pwa',
        display: 'standalone',
        theme_color: '#ffffff',
        background_color: '#ffffff',
        icons: [
          {
            src: 'pwa-192x192.png',
            sizes: '192x192',
            type: 'image/png',
          },
          {
            src: 'pwa-512x512.png',
            sizes: '512x512',
            type: 'image/png',
          },
          {
            src: 'pwa-512x512.png',
            sizes: '512x512',
            type: 'image/png',
            purpose: 'any maskable',
          },
        ],
      },
    }),
@userquin
Copy link
Member

The new version must be precached (downloaded and added to the cache storage), workbox precaching module will download your new assets sequentially (1 by 1).

You can patch your local workbox-precaching module copy: GoogleChrome/workbox#2880 (comment)

There is a PR in the repo to allow concurrent prefetching: GoogleChrome/workbox#3205

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants