If you still face this issue, I found a solution using Vite's PWA plugin: <https://vite-pwa-org.netlify.app/>
Here's how I set it up:
```
plugins: [
react(),
svgr({ svgrOptions: { icon: true }, include: "**/*.svg?react" }),
VitePWA({
registerType: "autoUpdate",
injectRegister: "auto",
workbox: {
maximumFileSizeToCacheInBytes: 15 * 1024 * 1024,
runtimeCaching: [
{
urlPattern: ({ request }) => request.destination === "script",
handler: "NetworkFirst",
options: {
cacheName: "js-cache",
expiration: {
maxEntries: 50,
maxAgeSeconds: 24 * 60 * 60,
},
},
},
],
},
}),
],
```
if someone faces this issue, I found a solution using Vite's PWA plugin: <https://vite-pwa-org.netlify.app/>
Here's how I set it up:
```js
plugins: [
react(),
svgr({ svgrOptions: { icon: true }, include: "**/*.svg?react" }),
VitePWA({
registerType: "autoUpdate",
injectRegister: "auto",
workbox: {
maximumFileSizeToCacheInBytes: 15 * 1024 * 1024,
runtimeCaching: [
{
urlPattern: ({ request }) => request.destination === "script",
handler: "NetworkFirst",
options: {
cacheName: "js-cache",
expiration: {
maxEntries: 50,
maxAgeSeconds: 24 * 60 * 60,
},
},
},
],
},
}),
],
```