Repository navigation
Expand file tree
/
Copy pathvite.config.ts
More file actions
102 lines (101 loc) · 4 KB
/
Copy pathvite.config.ts
File metadata and controls
102 lines (101 loc) · 4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import { VitePWA } from 'vite-plugin-pwa';
import path from 'path';
export default defineConfig({
plugins: [
react(),
VitePWA({
registerType: 'autoUpdate',
includeAssets: ['favicon.ico', 'apple-touch-icon.png', 'masked-icon.svg'],
manifest: {
name: 'eOffice - Advanced Office Suite',
short_name: 'eOffice',
description: 'The world\'s most advanced open-source office suite',
theme_color: '#1a56db',
background_color: '#ffffff',
display: 'standalone',
orientation: 'any',
scope: '/',
start_url: '/',
icons: [
{ src: '/icons/icon-72x72.png', sizes: '72x72', type: 'image/png' },
{ src: '/icons/icon-96x96.png', sizes: '96x96', type: 'image/png' },
{ src: '/icons/icon-128x128.png', sizes: '128x128', type: 'image/png' },
{ src: '/icons/icon-144x144.png', sizes: '144x144', type: 'image/png' },
{ src: '/icons/icon-152x152.png', sizes: '152x152', type: 'image/png' },
{ src: '/icons/icon-192x192.png', sizes: '192x192', type: 'image/png', purpose: 'any maskable' },
{ src: '/icons/icon-384x384.png', sizes: '384x384', type: 'image/png' },
{ src: '/icons/icon-512x512.png', sizes: '512x512', type: 'image/png', purpose: 'any maskable' }
],
shortcuts: [
{ name: 'New Document', url: '/writer/new', icons: [{ src: '/icons/writer-96.png', sizes: '96x96' }] },
{ name: 'New Spreadsheet', url: '/calc/new', icons: [{ src: '/icons/calc-96.png', sizes: '96x96' }] },
{ name: 'New Presentation', url: '/impress/new', icons: [{ src: '/icons/impress-96.png', sizes: '96x96' }] }
],
categories: ['productivity', 'utilities', 'business'],
lang: 'en',
dir: 'auto'
},
workbox: {
globPatterns: ['**/*.{js,css,html,ico,png,svg,woff2}'],
runtimeCaching: [
{
urlPattern: /^https:\/\/fonts\.googleapis\.com\/.*/i,
handler: 'CacheFirst',
options: { cacheName: 'google-fonts-cache', expiration: { maxEntries: 10, maxAgeSeconds: 60 * 60 * 24 * 365 } }
},
{
urlPattern: /^https:\/\/api\.eoffice\.app\/.*/i,
handler: 'NetworkFirst',
options: { cacheName: 'api-cache', expiration: { maxEntries: 50, maxAgeSeconds: 60 * 5 } }
}
]
}
})
],
resolve: {
alias: {
'@': path.resolve(__dirname, './src'),
'@components': path.resolve(__dirname, './src/components'),
'@pages': path.resolve(__dirname, './src/pages'),
'@hooks': path.resolve(__dirname, './src/hooks'),
'@utils': path.resolve(__dirname, './src/utils'),
'@store': path.resolve(__dirname, './src/store'),
'@services': path.resolve(__dirname, './src/services'),
'@i18n': path.resolve(__dirname, './src/i18n'),
'@styles': path.resolve(__dirname, './src/styles'),
'@workers': path.resolve(__dirname, './src/workers')
}
},
build: {
target: 'esnext',
minify: 'terser',
sourcemap: true,
rollupOptions: {
output: {
manualChunks: {
'react-vendor': ['react', 'react-dom', 'react-router-dom'],
'editor-vendor': ['@tiptap/react', '@tiptap/starter-kit'],
'spreadsheet-vendor': ['hyperformula', 'xlsx'],
'pdf-vendor': ['pdfjs-dist'],
'collab-vendor': ['yjs', 'y-websocket'],
'ui-vendor': ['framer-motion', 'lucide-react', 'recharts'],
'i18n-vendor': ['i18next', 'react-i18next']
}
}
},
chunkSizeWarningLimit: 1000
},
server: {
port: 3000,
host: true,
proxy: {
'/api': { target: 'https://api.eoffice.app', changeOrigin: true, rewrite: (p) => p.replace(/^\/api/, '') },
'/ws': { target: 'wss://collab.eoffice.app', ws: true, changeOrigin: true }
}
},
optimizeDeps: {
include: ['react', 'react-dom', 'react-router-dom', 'zustand', 'immer']
}
});