TypeScript · 2184 bytes Raw Blame History
1 import { defineConfig } from 'vite'
2 import vue from '@vitejs/plugin-vue'
3 import { VitePWA } from 'vite-plugin-pwa'
4 import { fileURLToPath, URL } from 'node:url'
5
6 export default defineConfig({
7 plugins: [
8 vue(),
9 VitePWA({
10 registerType: 'autoUpdate',
11 workbox: {
12 globPatterns: ['**/*.{js,css,html,ico,png,svg}'],
13 runtimeCaching: [
14 {
15 urlPattern: /^https:\/\/api\./,
16 handler: 'NetworkFirst',
17 options: {
18 cacheName: 'api-cache',
19 expiration: {
20 maxEntries: 100,
21 maxAgeSeconds: 60 * 60 * 24, // 24 hours
22 },
23 },
24 },
25 ],
26 },
27 manifest: {
28 name: 'ZephyrFS',
29 short_name: 'ZephyrFS',
30 description: 'Decentralized file storage with zero-knowledge encryption',
31 theme_color: '#1e40af',
32 background_color: '#ffffff',
33 display: 'standalone',
34 orientation: 'portrait',
35 scope: '/',
36 start_url: '/',
37 icons: [
38 {
39 src: '/icons/icon-192x192.png',
40 sizes: '192x192',
41 type: 'image/png',
42 },
43 {
44 src: '/icons/icon-512x512.png',
45 sizes: '512x512',
46 type: 'image/png',
47 },
48 ],
49 },
50 }),
51 ],
52 resolve: {
53 alias: {
54 '@': fileURLToPath(new URL('./src', import.meta.url)),
55 '@shared': fileURLToPath(new URL('../shared', import.meta.url)),
56 },
57 },
58 server: {
59 port: 5173,
60 proxy: {
61 '/api': {
62 target: 'http://localhost:3000',
63 changeOrigin: true,
64 },
65 },
66 },
67 build: {
68 target: 'esnext',
69 minify: 'terser',
70 terserOptions: {
71 compress: {
72 drop_console: true,
73 drop_debugger: true,
74 },
75 },
76 rollupOptions: {
77 output: {
78 manualChunks: {
79 'vue-vendor': ['vue', 'vue-router', 'pinia'],
80 'ui-vendor': ['@headlessui/vue', '@heroicons/vue'],
81 'uppy-vendor': ['@uppy/core', '@uppy/dashboard', '@uppy/xhr-upload'],
82 },
83 },
84 },
85 },
86 test: {
87 environment: 'jsdom',
88 globals: true,
89 },
90 })