-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.ts
55 lines (55 loc) · 1.29 KB
/
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
45
46
47
48
49
50
51
52
53
54
55
import { defineConfig, loadEnv } from 'vite'
import uni from '@dcloudio/vite-plugin-uni'
import vueJsx from '@vitejs/plugin-vue-jsx'
import AutoImport from 'unplugin-auto-import/vite'
import { resolve } from 'path'
// https://vitejs.dev/config/
export default defineConfig((config) => {
const { command, mode } = config
const env = loadEnv(mode, process.cwd())
return {
build: {
target: 'es6'
},
resolve: {
alias: [
{
find: '@',
replacement: resolve(__dirname, 'src')
}
]
},
plugins: [
uni(),
vueJsx(),
AutoImport({
imports: [
'vue',
'uni-app',
'pinia',
{
from: 'uni-mini-router',
imports: ['createRouter', 'useRouter', 'useRoute']
}
],
dts: 'src/auto-imports.d.ts',
dirs: ['src/store'],
eslintrc: {
enabled: true,
globalsPropValue: true
}
})
],
server: {
host: 'localhost',
port: Number(env.VITE_APP_PORT),
proxy: {
[env.VITE_APP_BASE_API]: {
target: env.VITE_APP_BASE_URL,
changeOrigin: true,
rewrite: (path: string) => path.replace(new RegExp(`^${env.VITE_APP_BASE_API}`), '')
}
}
}
}
})