30 lines
640 B
TypeScript
30 lines
640 B
TypeScript
import { defineConfig, loadEnv } from "vite";
|
|
import react from "@vitejs/plugin-react-swc";
|
|
import path from "path";
|
|
|
|
// https://vitejs.dev/config/
|
|
export default defineConfig(({ mode }) => {
|
|
const env = loadEnv(mode, process.cwd(), "");
|
|
const proxyTarget = env.VITE_API_PROXY_TARGET || "http://127.0.0.1:8000";
|
|
|
|
return {
|
|
server: {
|
|
host: "::",
|
|
port: 8080,
|
|
proxy: {
|
|
"/api": {
|
|
target: proxyTarget,
|
|
changeOrigin: true,
|
|
},
|
|
},
|
|
},
|
|
base: "/",
|
|
plugins: [react()],
|
|
resolve: {
|
|
alias: {
|
|
"@": path.resolve(__dirname, "./src"),
|
|
},
|
|
},
|
|
};
|
|
});
|