-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathvite.config.ts
44 lines (37 loc) · 977 Bytes
/
vite.config.ts
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
import { cwd } from 'node:process'
import { fileURLToPath, URL } from 'node:url'
import legacy from '@vitejs/plugin-legacy'
import vue from '@vitejs/plugin-vue'
import vueJsx from '@vitejs/plugin-vue-jsx'
import AutoImport from 'unplugin-auto-import/vite'
import { defineConfig, loadEnv } from 'vite'
import svgLoader from 'vite-svg-loader'
import generateProxy from './src/utils/dev-proxy/generate-proxy'
export default defineConfig(({ mode }) => {
const env = loadEnv(mode, cwd(), '')
return {
base: '/',
plugins: [
vue(),
vueJsx(),
legacy(),
svgLoader(),
AutoImport({
imports: ['vue', 'vue-router', 'pinia'],
dts: './typings/auto-imports.d.ts',
}),
],
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url)),
},
},
server: {
host: true,
open: true,
proxy: {
...generateProxy(env.VITE_PROXY_TARGETS),
},
},
}
})