Harden local setup and development startup
This commit is contained in:
+10
-4
@@ -1,19 +1,25 @@
|
||||
import { defineConfig } from "vite";
|
||||
import react from "@vitejs/plugin-react";
|
||||
import path from "node:path";
|
||||
import { fileURLToPath, URL } from "node:url";
|
||||
|
||||
const srcDir = fileURLToPath(new URL("./src", import.meta.url));
|
||||
const apiTarget = process.env.API_URL || "http://127.0.0.1:3000";
|
||||
const webPort = Number(process.env.VITE_PORT) || 5173;
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [react()],
|
||||
resolve: {
|
||||
alias: {
|
||||
"@": path.resolve(__dirname, "src"),
|
||||
"@": srcDir,
|
||||
},
|
||||
},
|
||||
server: {
|
||||
port: 5173,
|
||||
host: process.env.VITE_HOST || "127.0.0.1",
|
||||
port: webPort,
|
||||
strictPort: true,
|
||||
proxy: {
|
||||
"/api": {
|
||||
target: "http://localhost:3000",
|
||||
target: apiTarget,
|
||||
changeOrigin: true,
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user