import { defineConfig } from "vite"; import react from "@vitejs/plugin-react-swc"; import path from "path"; import { componentTagger } from "lovable-tagger"; import { VitePWA } from 'vite-plugin-pwa'; // https://vitejs.dev/config/ export default defineConfig(({ mode }) => ({ server: { host: "::", port: 8080, }, plugins: [ react(), mode === 'development' && componentTagger(), VitePWA({ registerType: 'autoUpdate', includeAssets: ['favicon.ico', 'robots.txt', 'placeholder.svg'], manifest: { name: 'OpChan - Ordinal Echo Chamber', short_name: 'OpChan', description: 'A decentralized forum powered by Waku with offline support', theme_color: '#000000', background_color: '#ffffff', display: 'standalone', scope: '/', start_url: '/', icons: [ { src: 'favicon.ico', sizes: '48x48', type: 'image/x-icon' }, { src: 'placeholder.svg', sizes: 'any', type: 'image/svg+xml', purpose: 'any maskable' } ] }, workbox: { globPatterns: ['**/*.{js,css,html,ico,png,svg}'], runtimeCaching: [ { urlPattern: /^https:\/\/fonts\.googleapis\.com\/.*/i, handler: 'CacheFirst', options: { cacheName: 'google-fonts-cache', expiration: { maxEntries: 10, maxAgeSeconds: 60 * 60 * 24 * 365 } } }, { urlPattern: /^https:\/\/fonts\.gstatic\.com\/.*/i, handler: 'CacheFirst', options: { cacheName: 'gstatic-fonts-cache', expiration: { maxEntries: 10, maxAgeSeconds: 60 * 60 * 24 * 365 } } } ] }, devOptions: { enabled: true } }) ].filter(Boolean), resolve: { alias: { "@": path.resolve(__dirname, "./src"), }, }, build: { target: 'es2022', } }));