yxdth5/vite.config.js

45 lines
1.2 KiB
JavaScript
Raw Normal View History

2023-12-08 09:44:23 +08:00
import { fileURLToPath, URL } from "node:url";
2023-12-07 09:39:34 +08:00
2023-12-08 09:44:23 +08:00
import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
2023-12-07 09:39:34 +08:00
// https://vitejs.dev/config/
export default defineConfig({
2023-12-08 09:44:23 +08:00
server: {
// ← ← ← ← ← ←
host: "0.0.0.0", // ← 新增内容 ←
2024-02-19 10:46:21 +08:00
hmr: true, // 自动热更新
proxy: {
2024-03-06 17:28:14 +08:00
"/generate": {
2024-03-06 15:04:14 +08:00
// target: "http://192.168.2.86:8003",
2024-03-06 17:28:14 +08:00
// target: "https://aiai.cityme.com.cn",
target: "https://yx.cityme.com.cn/",
2024-03-07 17:24:56 +08:00
// target: "http://192.168.2.86:8003/test/main_serve/",
2024-03-06 17:28:14 +08:00
2024-02-19 10:46:21 +08:00
changeOrigin: true,
2024-03-06 15:33:32 +08:00
// rewrite: (path) => path.replace(/\/test/, ""), //重写真实路径,替换/api
2024-02-19 10:46:21 +08:00
},
2024-03-07 17:24:56 +08:00
"^/test": {
target: "http://192.168.2.86:8003/",
changeOrigin: true,
rewrite: path => path.replace(/^\/test/, '/test/main_serve/')
},
2024-02-19 11:03:17 +08:00
'/srv': {
2024-03-06 17:28:14 +08:00
// target: "https://aiai.cityme.com.cn",
// target: 'http://36.140.118.172:88',//沈涛
target: "https://yx.cityme.com.cn/",
2024-02-19 11:03:17 +08:00
changeOrigin: true,
},
2024-02-19 10:46:21 +08:00
},
2023-12-07 17:15:51 +08:00
},
2023-12-08 09:44:23 +08:00
base: "./", //生产环境路径
plugins: [vue()],
2023-12-07 09:39:34 +08:00
resolve: {
alias: {
2023-12-08 09:44:23 +08:00
"@": fileURLToPath(new URL("./src", import.meta.url)),
},
},
});