BookSystem/frontend/vite.config.ts

28 lines
691 B
TypeScript

import { defineConfig, loadEnv } from "vite";
import vue from "@vitejs/plugin-vue";
import { fileURLToPath, URL } from "node:url";
export default defineConfig(({ mode }) => {
const env = loadEnv(mode, process.cwd(), "");
const proxyTarget = env.VITE_DEV_PROXY_TARGET || "http://127.0.0.1:8000";
return {
plugins: [vue()],
resolve: {
alias: {
"@": fileURLToPath(new URL("./src", import.meta.url)),
},
},
server: {
port: Number(env.VITE_DEV_PORT || 5173),
proxy: {
"/api": {
target: proxyTarget,
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, ""),
},
},
},
};
});