PWA: fix index.js pre-cache failing because of filesize, include the fonts, alarm mp3, favicon and apple-touch-icon in the pre-cache

This commit is contained in:
Matjaž Črnko 2024-04-04 19:38:31 +02:00
parent ced1341f66
commit cfa005ddca
3 changed files with 14 additions and 5 deletions

View File

@ -38,7 +38,7 @@
"recharts": "^2.10.4",
"redux": "^5.0.1",
"vite": "^5.0.13",
"vite-plugin-pwa": "^0.17.4",
"vite-plugin-pwa": "^0.19.7",
"vite-plugin-svgr": "^4.2.0",
"wellknown": "^0.5.0"
},
@ -11185,9 +11185,9 @@
}
},
"node_modules/vite-plugin-pwa": {
"version": "0.17.4",
"resolved": "https://registry.npmjs.org/vite-plugin-pwa/-/vite-plugin-pwa-0.17.4.tgz",
"integrity": "sha512-j9iiyinFOYyof4Zk3Q+DtmYyDVBDAi6PuMGNGq6uGI0pw7E+LNm9e+nQ2ep9obMP/kjdWwzilqUrlfVRj9OobA==",
"version": "0.19.7",
"resolved": "https://registry.npmjs.org/vite-plugin-pwa/-/vite-plugin-pwa-0.19.7.tgz",
"integrity": "sha512-18TECxoGPQE7tVZzKxbf5Icrl5688n1JGMPSgGotTsh89vLDxevY7ICfD3CFVfonZXh8ckuyJXg0NXE5+FAl2A==",
"dependencies": {
"debug": "^4.3.4",
"fast-glob": "^3.3.2",
@ -11202,9 +11202,15 @@
"url": "https://github.com/sponsors/antfu"
},
"peerDependencies": {
"@vite-pwa/assets-generator": "^0.2.4",
"vite": "^3.1.0 || ^4.0.0 || ^5.0.0",
"workbox-build": "^7.0.0",
"workbox-window": "^7.0.0"
},
"peerDependenciesMeta": {
"@vite-pwa/assets-generator": {
"optional": true
}
}
},
"node_modules/vite-plugin-svgr": {

View File

@ -34,7 +34,7 @@
"recharts": "^2.10.4",
"redux": "^5.0.1",
"vite": "^5.0.13",
"vite-plugin-pwa": "^0.17.4",
"vite-plugin-pwa": "^0.19.7",
"vite-plugin-svgr": "^4.2.0",
"wellknown": "^0.5.0"
},

View File

@ -19,8 +19,11 @@ export default defineConfig(() => ({
svgr(),
react(),
VitePWA({
includeAssets: ['favicon.ico', 'apple-touch-icon-180x180.png'],
workbox: {
navigateFallbackDenylist: [/^\/api/],
maximumFileSizeToCacheInBytes: 4000000,
globPatterns: ['**/*.{js,css,html,woff,woff2,mp3}'],
},
manifest: {
short_name: '${title}',