import { defineConfig } from 'vite' import vue from '@vitejs/plugin-vue' import { VitePWA } from 'vite-plugin-pwa' import { fileURLToPath, URL } from 'node:url' export default defineConfig({ plugins: [ vue(), VitePWA({ registerType: 'autoUpdate', workbox: { globPatterns: ['**/*.{js,css,html,ico,png,svg}'], runtimeCaching: [ { urlPattern: /^https:\/\/api\./, handler: 'NetworkFirst', options: { cacheName: 'api-cache', expiration: { maxEntries: 100, maxAgeSeconds: 60 * 60 * 24, // 24 hours }, }, }, ], }, manifest: { name: 'ZephyrFS', short_name: 'ZephyrFS', description: 'Decentralized file storage with zero-knowledge encryption', theme_color: '#1e40af', background_color: '#ffffff', display: 'standalone', orientation: 'portrait', scope: '/', start_url: '/', icons: [ { src: '/icons/icon-192x192.png', sizes: '192x192', type: 'image/png', }, { src: '/icons/icon-512x512.png', sizes: '512x512', type: 'image/png', }, ], }, }), ], resolve: { alias: { '@': fileURLToPath(new URL('./src', import.meta.url)), '@shared': fileURLToPath(new URL('../shared', import.meta.url)), }, }, server: { port: 5173, proxy: { '/api': { target: 'http://localhost:3000', changeOrigin: true, }, }, }, build: { target: 'esnext', minify: 'terser', terserOptions: { compress: { drop_console: true, drop_debugger: true, }, }, rollupOptions: { output: { manualChunks: { 'vue-vendor': ['vue', 'vue-router', 'pinia'], 'ui-vendor': ['@headlessui/vue', '@heroicons/vue'], 'uppy-vendor': ['@uppy/core', '@uppy/dashboard', '@uppy/xhr-upload'], }, }, }, }, test: { environment: 'jsdom', globals: true, }, })