yxdth5/vite.config.js

38 lines
982 B
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/",
changeOrigin: true,
// rewrite: (path) => path.replace(/\/test/, ""), //重写真实路径,替换/api
},
'/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)),
},
},
});