vite: precache images for pwa

This commit is contained in:
thislight 2024-10-27 14:19:56 +08:00
parent 4734a67f5a
commit c06d8b8c11
No known key found for this signature in database
GPG key ID: A50F9451AC56A63E

View file

@ -76,7 +76,7 @@ export default defineConfig(({ mode }) => {
strategies: "injectManifest", strategies: "injectManifest",
registerType: "autoUpdate", registerType: "autoUpdate",
devOptions: { devOptions: {
enabled: !["production", "staging"].includes(mode), enabled: true,
}, },
srcDir: "src/serviceworker", srcDir: "src/serviceworker",
filename: "main.ts", filename: "main.ts",
@ -84,6 +84,9 @@ export default defineConfig(({ mode }) => {
pwaAssets: { pwaAssets: {
config: true, config: true,
}, },
injectManifest: {
globPatterns: ["**/*.{js,wasm,css,html,svg,png,ico}"],
},
}), }),
version(), version(),
], ],