/* * vite.config.ts * Zyquo Cloud Web * * Author: Simon-Pierre Boucher * Mail: contact@spboucher.ai */ import { defineConfig } from 'vite' import react from '@vitejs/plugin-react' import { VitePWA } from 'vite-plugin-pwa' export default defineConfig({ // Overridable for subpath hosting (e.g. GitHub Pages sets VITE_BASE=/zyquo-cloud-web/). base: process.env.VITE_BASE ?? '/', plugins: [ react(), VitePWA({ registerType: 'autoUpdate', // The service worker precaches the app shell only (index + main bundle + // icons) — NEVER provider API responses or anything containing keys or // conversation content. Lazy chunks (mermaid, katex fonts) are cached at // runtime on first use, same-origin only. workbox: { globPatterns: [ 'index.html', 'registerSW.js', 'manifest.webmanifest', 'assets/index-*.js', 'assets/index-*.css', 'icons/*.{svg,png}', ], navigateFallback: 'index.html', runtimeCaching: [ { // Same-origin lazy assets only (providers are never under /assets/, // and runtime caching applies to GET requests only). urlPattern: /\/assets\/.+\.(js|css|woff2)$/, handler: 'CacheFirst', options: { cacheName: 'zyquo-shell-lazy', expiration: { maxEntries: 200, maxAgeSeconds: 60 * 60 * 24 * 90 }, }, }, ], }, manifest: { name: 'Zyquo Cloud', short_name: 'Zyquo Cloud', description: 'Multi-provider AI chat that lives entirely in your browser — your keys, your history, no backend.', start_url: '/', display: 'standalone', background_color: '#FAFBFD', theme_color: '#FAFBFD', // Relative to the manifest's location so subpath deploys keep working. icons: [ { src: 'icons/icon-192.png', sizes: '192x192', type: 'image/png' }, { src: 'icons/icon-512.png', sizes: '512x512', type: 'image/png' }, { src: 'icons/icon-512-maskable.png', sizes: '512x512', type: 'image/png', purpose: 'maskable', }, ], }, }), ], build: { target: 'es2022', sourcemap: false, }, })