From c06d8b8c118e1969764b90bedf63989c1208ace4 Mon Sep 17 00:00:00 2001 From: thislight Date: Sun, 27 Oct 2024 14:19:56 +0800 Subject: [PATCH] vite: precache images for pwa --- vite.config.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/vite.config.ts b/vite.config.ts index db04793..3b37a34 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -76,7 +76,7 @@ export default defineConfig(({ mode }) => { strategies: "injectManifest", registerType: "autoUpdate", devOptions: { - enabled: !["production", "staging"].includes(mode), + enabled: true, }, srcDir: "src/serviceworker", filename: "main.ts", @@ -84,6 +84,9 @@ export default defineConfig(({ mode }) => { pwaAssets: { config: true, }, + injectManifest: { + globPatterns: ["**/*.{js,wasm,css,html,svg,png,ico}"], + }, }), version(), ],