import { defineConfig } from "vite"; import react from "@vitejs/plugin-react"; import { VitePWA } from "vite-plugin-pwa"; export default defineConfig({ plugins: [ react(), VitePWA({ registerType: "autoUpdate", manifest: { name: "Apothecary", short_name: "Apothecary", description: "Personal cannabis inventory tracker", theme_color: "#f5efe6", background_color: "#f5efe6", display: "standalone", scope: "/", start_url: "/", icons: [ { src: "/icons/icon-192.svg", sizes: "192x192", type: "image/svg+xml" }, { src: "/icons/icon-512.svg", sizes: "512x512", type: "image/svg+xml" }, { src: "/icons/maskable-512.svg", sizes: "512x512", type: "image/svg+xml", purpose: "maskable" }, ], }, workbox: { globPatterns: ["**/*.{js,css,html,woff2}"], runtimeCaching: [ { urlPattern: /^https:\/\/fonts\.googleapis\.com/, handler: "CacheFirst", options: { cacheName: "google-fonts-stylesheets" }, }, { urlPattern: /^https:\/\/fonts\.gstatic\.com/, handler: "CacheFirst", options: { cacheName: "google-fonts-webfonts", expiration: { maxEntries: 10 }, }, }, { urlPattern: /\/api\//, handler: "NetworkFirst", options: { cacheName: "api-cache", networkTimeoutSeconds: 5, }, }, ], }, }), ], server: { port: 5173, proxy: { "/api": { target: "http://localhost:4000", changeOrigin: true, }, }, }, });