forked from AIDotNet/MoYuCode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.ts
More file actions
91 lines (89 loc) · 2.25 KB
/
vite.config.ts
File metadata and controls
91 lines (89 loc) · 2.25 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
import path from "path"
import tailwindcss from "@tailwindcss/vite"
import react from "@vitejs/plugin-react"
import { defineConfig } from "vite"
import { VitePWA } from 'vite-plugin-pwa'
// @ts-ignore
const pwaPlugin = VitePWA({
registerType: 'autoUpdate',
includeAssets: ['favicon.ico', 'favicon.png'],
manifest: {
name: 'MyYuCode(摸鱼Coding)',
short_name: 'MyYuCode',
description: 'AI-powered coding assistant with Codex and Claude Code integration',
theme_color: '#000000',
background_color: '#ffffff',
display: 'standalone',
icons: [
{
src: 'favicon.png',
sizes: '512x512',
type: 'image/png',
purpose: 'any maskable'
}
]
},
workbox: {
maximumFileSizeToCacheInBytes: 10 * 1024 * 1024, // 10 MB
globPatterns: ['**/*.{js,css,html,ico,png,svg,woff2}'],
runtimeCaching: [
{
urlPattern: /^https:\/\/api\//i,
handler: 'NetworkFirst',
options: {
cacheName: 'api-cache',
expiration: {
maxEntries: 50,
maxAgeSeconds: 60 * 60 * 24 // 24 hours
}
}
},
{
urlPattern: /\.(?:png|jpg|jpeg|svg|gif|ico|webp)$/i,
handler: 'CacheFirst',
options: {
cacheName: 'image-cache',
expiration: {
maxEntries: 100,
maxAgeSeconds: 60 * 60 * 24 * 30 // 30 days
}
}
}
]
}
})
// https://vite.dev/config/
export default defineConfig({
plugins: [
react(),
tailwindcss(),
pwaPlugin as any
],
resolve: {
alias: {
"@": path.resolve(__dirname, "./src"),
"@animate-ui/components-buttons-theme-toggler": path.resolve(
__dirname,
"./src/components/animate-ui/components/buttons/theme-toggler",
),
"@animate-ui/components-base-files": path.resolve(
__dirname,
"./src/components/animate-ui/components/radix/files",
),
},
},
server: {
proxy: {
'/api': {
target: 'http://localhost:9110',
changeOrigin: true,
ws: true, // 启用 WebSocket 代理
// 不重写路径,保持 /api 前缀
},
'/.well-known': {
target: 'http://localhost:9110',
changeOrigin: true,
},
}
}
})