This repository was archived by the owner on Mar 28, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.ts
More file actions
76 lines (71 loc) · 1.78 KB
/
Copy pathvite.config.ts
File metadata and controls
76 lines (71 loc) · 1.78 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
// vite.config.ts
import { defineConfig, loadEnv, ConfigEnv } from 'vite'
import vue from '@vitejs/plugin-vue'
import AutoImport from 'unplugin-auto-import/vite'
import Components from 'unplugin-vue-components/vite'
import { NaiveUiResolver } from 'unplugin-vue-components/resolvers'
import { resolve } from 'path'
const pathResolve = (dir: string): any => {
return resolve(__dirname, ".", dir)
}
const alias: Record<string, string> = {
'@': pathResolve("src")
}
// https://vitejs.dev/config/
export default ({ mode }: ConfigEnv) => {
const basePublicPath: string = loadEnv(mode, process.cwd()).VITE_BASE_PUBLIC_PATH
return defineConfig({
// base: basePublicPath,
server: {
host: '0.0.0.0',
proxy: {
'/api/v1': {
// target: 'https://api.ylmty.cc',
target: 'http://127.0.0.1:9090',
changeOrigin: true,
// rewrite: (path) => path.replace(/^\/api\/v1/, '')
},
'/uploads': {
// target: 'https://api.ylmty.cc',
target: 'http://127.0.0.1:9090',
changeOrigin: true,
// rewrite: (path) => path.replace(/^\/uploads/, '')
}
}
},
css: {
preprocessorOptions: {
scss: {
api: "modern-compiler"
}
}
},
build: {
outDir: basePublicPath, // 指定输出文件夹路径
},
plugins: [
vue(),
AutoImport({
imports: [
'vue',
{
'naive-ui': [
'useDialog',
'useMessage',
'useNotification',
'useLoadingBar'
]
},
],
dts: 'src/auto-imports.d.ts'
}),
Components({
resolvers: [NaiveUiResolver()]
})
],
resolve: {
alias
},
// 自动导入
})
}