import { fileURLToPath, URL } from 'node:url' import { defineConfig } from 'vite' import vue from '@vitejs/plugin-vue' import { VitePWA } from 'vite-plugin-pwa' // https://vite.dev/config/ export default defineConfig({ plugins: [ vue(), VitePWA({ registerType: 'autoUpdate', workbox: { globPatterns: ['**/*.{js,css,html,ico,png,svg}'], runtimeCaching: [ { urlPattern: /^https:\/\/api\./i, handler: 'NetworkFirst', options: { cacheName: 'api-cache', expiration: { maxEntries: 10, maxAgeSeconds: 60 * 60 * 24 * 7, // 1 week }, }, }, ], }, includeAssets: ['favicon.ico', 'apple-touch-icon.png', 'masked-icon.svg'], manifest: { name: 'Video Call App', short_name: 'VideoCall', description: 'Secure video calling without registration', theme_color: '#00C853', background_color: '#ffffff', display: 'standalone', orientation: 'portrait', start_url: '/', scope: '/', categories: ['communication', 'productivity'], icons: [ { src: 'pwa-192x192.png', sizes: '192x192', type: 'image/png', }, { src: 'pwa-512x512.png', sizes: '512x512', type: 'image/png', }, { src: 'pwa-512x512.png', sizes: '512x512', type: 'image/png', purpose: 'any maskable', }, ], shortcuts: [ { name: 'Create Room', short_name: 'Create', description: 'Start a new video call', url: '/?action=create', icons: [ { src: 'pwa-192x192.png', sizes: '192x192', }, ], }, { name: 'Join Room', short_name: 'Join', description: 'Join an existing video call', url: '/?action=join', icons: [ { src: 'pwa-192x192.png', sizes: '192x192', }, ], }, ], }, devOptions: { enabled: true, // Enable PWA in development }, }), ], resolve: { alias: { '@': fileURLToPath(new URL('./src', import.meta.url)), }, }, server: { host: true, port: 3000, strictPort: true, }, build: { target: 'esnext', sourcemap: true, }, define: { __VUE_OPTIONS_API__: false, __VUE_PROD_DEVTOOLS__: false, }, })