-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.ts
More file actions
68 lines (65 loc) · 2 KB
/
vite.config.ts
File metadata and controls
68 lines (65 loc) · 2 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
import { defineConfig, loadEnv } from 'vite'
import vue from '@vitejs/plugin-vue'
import svgLoader from 'vite-svg-loader'
import { fileURLToPath } from 'node:url'
import { dirname, resolve } from 'node:path'
const __filename = fileURLToPath(import.meta.url)
const __dirname = dirname(__filename)
export default defineConfig(({ mode }) => {
const env = loadEnv(mode, process.cwd(), '')
const apiTarget = env.VITE_API_URL
return {
plugins: [
vue(),
svgLoader(),
],
define: {
__VUE_I18N_FULL_INSTALL__: true,
__VUE_I18N_LEGACY_API__: true,
__INTLIFY_JIT_COMPILATION__: true,
__INTLIFY_DROP_MESSAGE_COMPILER__: false,
__INTLIFY_PROD_DEVTOOLS__: false,
},
resolve: {
alias: {
'@': resolve(__dirname, './src'),
},
},
css: {
preprocessorOptions: {
scss: {
},
},
},
server: {
proxy: {
'/api': {
target: apiTarget,
changeOrigin: true,
secure: false,
},
},
},
build: {
chunkSizeWarningLimit: 1200,
rollupOptions: {
output: {
manualChunks(id) {
if (id.includes('node_modules')) {
if (id.includes('vue') || id.includes('pinia')) {
return 'vendor-vue'
}
if (id.includes('@intlify')) {
return 'vendor-i18n'
}
if (id.includes('maplibre')) {
return 'vendor-maplibre'
}
return 'vendor'
}
},
},
},
},
}
})