Files
storybid/packages/client/vite.config.ts
T
2026-05-04 14:23:10 -05:00

52 lines
1.5 KiB
TypeScript

import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import { VitePWA } from "vite-plugin-pwa";
export default defineConfig({
plugins: [
react(),
VitePWA({
registerType: "autoUpdate",
workbox: {
globPatterns: ["**/*.{js,css,html,ico,png,svg,woff2}"],
runtimeCaching: [
{
// Cache API catalog responses (silent auction items) for offline browsing
urlPattern: /\/api\/items/,
handler: "NetworkFirst",
options: {
cacheName: "api-items",
expiration: { maxEntries: 200, maxAgeSeconds: 60 * 60 },
},
},
{
// Always network-first for live bidding endpoints
urlPattern: /\/api\/bids/,
handler: "NetworkOnly",
},
],
},
manifest: {
name: "Storybid Auction",
short_name: "Storybid",
description: "Live and silent charity auction bidding",
theme_color: "#2563eb",
background_color: "#ffffff",
display: "standalone",
orientation: "portrait",
start_url: "/",
icons: [
{ src: "/icons/icon.svg", sizes: "any", type: "image/svg+xml", purpose: "any maskable" },
],
},
}),
],
server: {
port: 5173,
proxy: {
"/api": { target: "http://localhost:3001", changeOrigin: true },
"/socket.io": { target: "http://localhost:3001", ws: true },
},
},
});