import { fileURLToPath, URL } from 'node:url' import react from '@vitejs/plugin-react' import { defineConfig } from 'vite' import { VitePWA } from 'vite-plugin-pwa' export default defineConfig({ publicDir: fileURLToPath(new URL('../../packages/fieldlens-core/public', import.meta.url)), plugins: [ react(), VitePWA({ registerType: 'prompt', includeAssets: ['fieldlens-mark.svg', 'apple-touch-icon.png', 'pwa-192.png', 'pwa-512.png'], manifest: { name: 'FieldLens Capture', short_name: 'FieldLens', description: 'Local-first barcode, pallet and carton-label capture.', theme_color: '#17211f', background_color: '#f7f7f2', display: 'standalone', start_url: '/', icons: [ { src: '/pwa-192.png', sizes: '192x192', type: 'image/png', purpose: 'any' }, { src: '/pwa-512.png', sizes: '512x512', type: 'image/png', purpose: 'any' }, { src: '/pwa-512.png', sizes: '512x512', type: 'image/png', purpose: 'maskable' } ] }, workbox: { cleanupOutdatedCaches: true, navigateFallback: '/index.html', navigateFallbackDenylist: [/^\/downloads\//, /^\/api\//], globPatterns: ['**/*.{js,css,html,svg,wasm,png}'] } }) ] })