library-picturebook-activity/frontend/vite.config.js

39 lines
928 B
JavaScript
Raw Normal View History

import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import { resolve } from "path";
// 根据环境设置 base 路径
var getBase = function (mode) {
switch (mode) {
case "test":
return "/web-test/";
case "production":
return "/web/";
default:
return "/";
}
};
// https://vitejs.dev/config/
export default defineConfig(function (_a) {
var mode = _a.mode;
return {
base: getBase(mode),
plugins: [vue()],
resolve: {
alias: {
"@": resolve(__dirname, "src"),
},
},
server: {
host: "0.0.0.0",
port: 3000,
proxy: {
// 主后端
"/api": {
target: "http://localhost:8580",
changeOrigin: true,
},
},
},
};
});