diff options
| author | nsfisis <nsfisis@gmail.com> | 2025-12-07 18:53:56 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2025-12-07 18:53:56 +0900 |
| commit | 4b755c758e920fb0295b066fa20ce6667334546b (patch) | |
| tree | c9d8c7a8fa22b65214e7aa9a20dcfebf6c83c6a9 /vite.config.ts | |
| parent | f443ac18ccb8ab34fb5bf69b0802eb69cf89cf06 (diff) | |
| download | kioku-4b755c758e920fb0295b066fa20ce6667334546b.tar.gz kioku-4b755c758e920fb0295b066fa20ce6667334546b.tar.zst kioku-4b755c758e920fb0295b066fa20ce6667334546b.zip | |
feat(pwa): add PWA support with vite-plugin-pwa
Configure Progressive Web App functionality:
- Add vite-plugin-pwa with workbox for service worker
- Create web manifest with app metadata and icons
- Add offline fallback page for when network is unavailable
- Update index.html with PWA meta tags and theme color
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Diffstat (limited to 'vite.config.ts')
| -rw-r--r-- | vite.config.ts | 45 |
1 files changed, 44 insertions, 1 deletions
diff --git a/vite.config.ts b/vite.config.ts index 757a0af..b35f941 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -1,8 +1,51 @@ import react from "@vitejs/plugin-react"; import { defineConfig } from "vite"; +import { VitePWA } from "vite-plugin-pwa"; export default defineConfig({ - plugins: [react()], + plugins: [ + react(), + VitePWA({ + registerType: "autoUpdate", + includeAssets: ["icon.svg"], + manifest: { + name: "Kioku", + short_name: "Kioku", + description: "A spaced repetition learning app", + theme_color: "#4CAF50", + background_color: "#ffffff", + display: "standalone", + scope: "/", + start_url: "/", + icons: [ + { + src: "icon.svg", + sizes: "any", + type: "image/svg+xml", + purpose: "any maskable", + }, + ], + }, + workbox: { + globPatterns: ["**/*.{js,css,html,svg,png,ico,woff,woff2}"], + runtimeCaching: [ + { + urlPattern: /^https:\/\/.*\.(?:png|jpg|jpeg|svg|gif|webp)$/, + handler: "CacheFirst", + options: { + cacheName: "images-cache", + expiration: { + maxEntries: 50, + maxAgeSeconds: 60 * 60 * 24 * 30, + }, + }, + }, + ], + navigateFallback: "/offline.html", + navigateFallbackDenylist: [/^\/api\//], + }, + }), + ], root: ".", build: { outDir: "dist/client", |
