-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathvite.config.ts
More file actions
56 lines (54 loc) · 1.53 KB
/
Copy pathvite.config.ts
File metadata and controls
56 lines (54 loc) · 1.53 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
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import path from 'path'
const host = process.env.TAURI_DEV_HOST
export default defineConfig(async () => {
const pkg = await import('./package.json', { with: { type: 'json' } })
return {
plugins: [react()],
define: {
__APP_VERSION__: JSON.stringify(pkg.default.version),
},
resolve: {
alias: {
'@': path.resolve(__dirname, './src'),
},
},
build: {
rollupOptions: {
output: {
manualChunks(id: string) {
if (!id.includes('node_modules')) return
if (id.includes('/react/') || id.includes('/react-dom/') || id.includes('/scheduler/')) return 'vendor-react'
if (id.includes('@radix-ui')) return 'vendor-radix'
if (id.includes('i18next')) return 'vendor-i18n'
if (
id.includes('react-markdown') ||
id.includes('remark-') ||
id.includes('rehype-') ||
id.includes('/unified/') ||
id.includes('/micromark/') ||
id.includes('/mdast-') ||
id.includes('/hast-')
) {
return 'vendor-markdown'
}
return 'vendor'
},
},
},
},
clearScreen: false,
server: {
port: 14200,
strictPort: true,
host: host || false,
hmr: host
? { protocol: 'ws', host, port: 14201 }
: undefined,
watch: {
ignored: ['**/src-tauri/**'],
},
},
}
})