I just found the solution with this configuration with the vite-plugin-pwa.
VitePWA({
buildBase: '/build/',
scope: '/',
base: '/',
registerType: 'autoUpdate',
devOptions: {
enabled: false,
},
injectRegister: 'auto',
includeAssets: [],
manifest: {
name: 'Les Meeples Perdus d\'Aurillac',
short_name: 'MPA',
start_url: '/',
scope: '/',
background_color: '#ffffff',
theme_color: '#ffffff',
display: 'standalone',
orientation: 'any',
status_bar: '#ffffff',
icons: [
{
src: '/pwa/icon-72x72.png',
sizes: '72x72',
type: 'image/png',
},
{
src: '/pwa/icon-96x96.png',
sizes: '96x96',
type: 'image/png',
},
{
src: '/pwa/icon-128x128.png',
sizes: '128x128',
type: 'image/png',
},
{
src: '/pwa/icon-144x144.png',
sizes: '144x144',
type: 'image/png',
},
{
src: '/pwa/icon-152x152.png',
sizes: '152x152',
type: 'image/png',
},
{
src: '/pwa/icon-192x192.png',
sizes: '192x192',
type: 'image/png',
},
{
src: '/pwa/icon-384x384.png',
sizes: '384x384',
type: 'image/png',
},
{
src: '/pwa/icon-512x512.png',
sizes: '512x512',
type: 'image/png',
},
],
// // 'splash' => [
// // '640x1136' => '/pwa/splash-640x1136.png',
// // '750x1334' => '/pwa/splash-750x1334.png',
// // '828x1792' => '/pwa/splash-828x1792.png',
// // '1125x2436' => '/pwa/splash-1125x2436.png',
// // '1242x2208' => '/pwa/splash-1242x2208.png',
// // '1242x2688' => '/pwa/splash-1242x2688.png',
// // '1536x2048' => '/pwa/splash-1536x2048.png',
// // '1668x2224' => '/pwa/splash-1668x2224.png',
// // '1668x2388' => '/pwa/splash-1668x2388.png',
// // '2048x2732' => '/pwa/splash-2048x2732.png',
// // ],
},
workbox: {
globPatterns: ["**/*.{js,css,html,ico,png,svg,webmanifest}"],
runtimeCaching: [
{
urlPattern: ({ request }) => request.destination === 'style' || request.destination === 'script' || request.destination === 'worker',
handler: 'StaleWhileRevalidate',
options: {
cacheName: 'static-resources',
expiration: {
maxEntries: 50,
maxAgeSeconds: 30 * 24 * 60 * 60, // 30 days
},
},
},
{
urlPattern: ({ request }) => request.destination === 'image',
handler: 'CacheFirst',
options: {
cacheName: 'images',
expiration: {
maxEntries: 100,
maxAgeSeconds: 60 * 24 * 60 * 60, // 60 days
},
},
},
],
},
}),