import { defineConfig } from 'vite' import react from '@vitejs/plugin-react' import { VitePWA } from 'vite-plugin-pwa' // https://vitejs.dev/config/ export default defineConfig({ plugins: [ react(), VitePWA({ strategies: 'injectManifest', srcDir: 'src', filename: 'sw-custom.js', registerType: 'autoUpdate', injectRegister: 'auto', devOptions: { enabled: false }, workbox: { globPatterns: ['**/*.{js,css,html,ico,png,svg,webp,woff,woff2}'], // Simplified for faster builds maximumFileSizeToCacheInBytes: 3000000 }, includeAssets: ['pwa-192x192.png', 'pwa-512x512.png'], manifest: { name: 'snStatus', short_name: 'snStatus', theme_color: '#1e3a8a', background_color: '#1e3a8a', // Deep Navy for splash display: 'standalone', start_url: '/', icons: [ { src: 'pwa-192x192.png', sizes: '192x192', type: 'image/png' }, { src: 'pwa-512x512.png', sizes: '512x512', type: 'image/png', purpose: 'any maskable' } ] } }) ], build: { // Optimize for faster builds on NAS sourcemap: false, // Disable source maps minify: 'esbuild', // Use faster esbuild minifier target: 'es2015', // Less transformation needed cssCodeSplit: false, // Single CSS file rollupOptions: { output: { manualChunks: undefined // Disable code splitting for faster build } }, chunkSizeWarningLimit: 2000 // Suppress warnings }, server: { port: 3000, host: true, proxy: { '/api': { target: 'http://backend:3001', changeOrigin: true, } } } })