yxdth5/vite.config.js

46 lines
1.2 KiB
JavaScript

import { fileURLToPath, URL } from "node:url";
import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
// https://vitejs.dev/config/
export default defineConfig({
server: {
// ← ← ← ← ← ←
host: "0.0.0.0", // ← 新增内容 ←
hmr: true, // 自动热更新
proxy: {
"/generate": {
// target: "http://192.168.2.86:8003",
// target: "https://aiai.cityme.com.cn",
target: "https://yx.cityme.com.cn/",
// target: "http://192.168.2.86:8003/test/main_serve/",
changeOrigin: true,
// rewrite: (path) => path.replace(/\/test/, ""), //重写真实路径,替换/api
},
"^/test": {
// target: "http://192.168.2.86:8003/",
target: "https://yx.cityme.com.cn/",
changeOrigin: true,
rewrite: path => path.replace(/^\/test/, '/test/main_serve/')
},
'/srv': {
// target: "https://aiai.cityme.com.cn",
// target: 'http://36.140.118.172:88',//沈涛
target: "https://yx.cityme.com.cn/",
changeOrigin: true,
},
},
},
base: "./", //生产环境路径
plugins: [vue()],
resolve: {
alias: {
"@": fileURLToPath(new URL("./src", import.meta.url)),
},
},
});