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
| import { fileURLToPath, URL } from 'node:url'
|
| import { defineConfig } from 'vite'
| import vue from '@vitejs/plugin-vue'
| import vueDevTools from 'vite-plugin-vue-devtools'
| import cesium from 'vite-plugin-cesium';
|
| // https://vite.dev/config/
| export default defineConfig({
| base: '/pilot-h5/', // 设置打包地址前缀
| plugins: [
| vue(),
| cesium(),
| // vueDevTools(),
| ],
| resolve: {
| alias: {
| '@': fileURLToPath(new URL('./src', import.meta.url))
| },
| },
| server: {
| open: true,
| host: '192.168.1.178',
| port: 5173,
| proxy: {
| '/index/api': {
| target: 'https://wrj.shuixiongit.com/index/api',
| changeOrigin: true,
| // ws: true,
| rewrite: (path) => path.replace(new RegExp(`^/index/api`), ''),
| },
| '/api': {
| // 代理请求之后的请求地址(你的真实接口地址)
| target: 'https://wrj.shuixiongit.com/api',
| rewrite: (path) => path.replace(new RegExp(`^/api`), ''),
| // 跨域
| changeOrigin: true,
| },
| }
| }
| })
|
|