|
|
@@ -1,18 +1,21 @@
|
|
|
-import { defineConfig } from 'vite'
|
|
|
-import uni from '@dcloudio/vite-plugin-uni'
|
|
|
+import { defineConfig } from "vite";
|
|
|
+import uni from "@dcloudio/vite-plugin-uni";
|
|
|
|
|
|
// H5 dev: 通过 Vite 代理把 /api 转发到后端,避开浏览器 CORS。
|
|
|
// 接入新后端时,把 API_TARGET 改成对应环境即可。
|
|
|
-const API_TARGET = 'http://aiot.zoomwin.com.cn:51001'
|
|
|
+const API_TARGET = 'http://aiot.zoomwin.com.cn:51001/api'
|
|
|
+// const API_TARGET = "http://192.168.1.147:18086";
|
|
|
+// const API_TARGET = "http://192.168.1.102:18086";
|
|
|
|
|
|
export default defineConfig({
|
|
|
plugins: [uni()],
|
|
|
server: {
|
|
|
proxy: {
|
|
|
- '/api': {
|
|
|
+ "/api": {
|
|
|
target: API_TARGET,
|
|
|
changeOrigin: true,
|
|
|
+ rewrite: (path) => path.replace(/^\/api/, ''),
|
|
|
},
|
|
|
},
|
|
|
},
|
|
|
-})
|
|
|
+});
|