antfu-collective / vitesse

🏕 Opinionated Vite + Vue Starter Template
https://vitesse.netlify.app/
MIT License
8.79k stars 932 forks source link

[bug ] : can't force my website visitors to get the new version #502

Closed moHaHa closed 1 year ago

moHaHa commented 1 year ago

Describe the bug

my client open the website the I always update , but he got the old version , I can't force the visitors to get the new versoin without say "hi , please clear cache on you browser or press CRTL + f5 " , and it sometimes works and sometime not

my make this edit

  1. remove pwa.ts to pwa.md (I don't want to delete it )
  2. // import { VitePWA } from 'vite-plugin-pwa'
  3. // VitePWA({
    //   registerType: 'autoUpdate',
    //   includeAssets: ['favicon.svg', 'safari-pinned-tab.svg'],
    //   manifest: {
    //     name: 'Vitesse',
    //     short_name: 'Vitesse',
    //     theme_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',
    //       },
    //     ],
    //   },
    // }),

in new website verion the download icon removed from the borwser but how do I clear the cache from the other visitors ?

Reproduction

https://almodonholding.mohaha.me

System Info

chrome , windows

Used Package Manager

pnpm

Validations

userquin commented 1 year ago

If you are removing the pwa just add pwa again adding selfDestroying: true and the sw and the caches will be removed from all clients. Check pwa docs https://vite-pwa-org.netlify.app/guide/unregister-service-worker.html

moHaHa commented 1 year ago

@userquin I just add the PWA again, with this config line selfDestroying: true the problems solved: ✅

Thank you very much for the answer 🙏. I would like to sponsor you, but unfortunately, my country (Syria) is blocked from accessing many services, including e-pay.

moHaHa commented 1 year ago

selfDestroying: true solve the issue ✔️

read more : https://vite-pwa-org.netlify.app/guide/unregister-service-worker.html