-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathvite.config.js
85 lines (82 loc) · 3.05 KB
/
vite.config.js
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
77
78
79
80
81
82
83
84
85
import { fileURLToPath, URL } from 'node:url'
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import vueDevTools from 'vite-plugin-vue-devtools'
import AutoImport from 'unplugin-auto-import/vite'
import Components from 'unplugin-vue-components/vite'
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
import { vitePluginMars3d } from 'vite-plugin-mars3d'
import postCssPxToRem from 'postcss-pxtorem'
// https://vitejs.dev/config/
export default async () => {
const UnoCSS = (await import('unocss/vite')).default
return defineConfig({
plugins: [
vue(),
vueDevTools(),
vitePluginMars3d(),
AutoImport({
resolvers: [ElementPlusResolver()]
}),
Components({
resolvers: [ElementPlusResolver()]
}),
UnoCSS()
],
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url))
}
},
css: {
postcss: {
plugins: [
postCssPxToRem({
rootValue: 192, // (屏幕分辨率宽度 / 缩放倍数 / 10)
propList: ['*']
})
]
}
},
server: {
proxy: {
'/wpd-sanming': {
target: 'https://web.cjwsjyszyh.com:1202/wpd-sanming', // 接口的域名
secure: false, // 如果是https接口,需要配置这个参数
changeOrigin: true, // 如果接口跨域,需要进行这个参数配置
rewrite: (path) => path.replace(/^\/wpd-sanming/, '')
},
'^/geoserver': {
target: 'https://web.cjwsjyszyh.com:1202/geoserver',
secure: false, // 如果是https接口,需要配置这个参数
changeOrigin: true, // 如果接口跨域,需要进行这个参数配置
rewrite: (path) => path.replace(/^\/geoserver/, '')
},
'^/smsk3dtiles': {
target: 'https://web.cjwsjyszyh.com:1202/smsk3dtiles',
secure: false, // 如果是https接口,需要配置这个参数
changeOrigin: true, // 如果接口跨域,需要进行这个参数配置
rewrite: (path) => path.replace(/^\/smsk3dtiles/, '')
},
'^/weather': {
target: 'http://175.44.138.53:5567',
secure: false, // 如果是https接口,需要配置这个参数
changeOrigin: true, // 如果接口跨域,需要进行这个参数配置
rewrite: (path) => path.replace(/^\/weather/, '')
},
'^/ztq': {
target: 'http://175.44.138.53:5566/api',
secure: false, // 如果是https接口,需要配置这个参数
changeOrigin: true, // 如果接口跨域,需要进行这个参数配置
rewrite: (path) => path.replace(/^\/ztq/, '')
},
'^/smallWatershed': {
target: 'https://web.cjwsjyszyh.com:1202/qicp',
secure: false, // 如果是https接口,需要配置这个参数
changeOrigin: true, // 如果接口跨域,需要进行这个参数配置
rewrite: (path) => path.replace(/^\/smallWatershed/, '')
}
}
}
})
}