-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathvite.config.ts
More file actions
50 lines (49 loc) · 1.47 KB
/
Copy pathvite.config.ts
File metadata and controls
50 lines (49 loc) · 1.47 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
import path from 'node:path'
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
export default defineConfig({
// Electron loads dist/index.html via file:// in packaged builds.
// Relative base keeps asset URLs resolvable outside a web server.
base: './',
server: {
watch: {
ignored: ['**/dist-electron/**', '**/electron/extensions/builtin/**/dist/**', '**/release/**'],
},
},
plugins: [react()],
build: {
rollupOptions: {
output: {
manualChunks(id) {
if (!id.includes('node_modules')) {
return undefined
}
if (id.includes('/react/') || id.includes('/react-dom/') || id.includes('/scheduler/')) {
return 'vendor-react'
}
if (id.includes('/framer-motion/')) {
return 'vendor-motion'
}
if (id.includes('/lucide-react/')) {
return 'vendor-icons'
}
if (id.includes('/react-markdown/') || id.includes('/remark-gfm/') || id.includes('/react-syntax-highlighter/')) {
return 'vendor-markdown'
}
if (id.includes('/i18next/') || id.includes('/react-i18next/')) {
return 'vendor-i18n'
}
return 'vendor'
},
},
},
},
define: {
'import.meta.env.VITE_APP_VERSION': JSON.stringify(process.env.npm_package_version || '0.1.0'),
},
resolve: {
alias: {
'@': path.resolve(__dirname, './src'),
},
},
})