import { defineConfig, loadEnv, } from "vite"; import react from "@vitejs/plugin-react"; // https://vite.dev/config/ export default defineConfig(({ mode }) => { const env = loadEnv(mode, process.cwd(), ""); const port = Number(env.VITE_PORT); if (!port) { console.error("Not found VITE_PORT, add VITE_PORT in .env"); throw new Error("Not found VITE_PORT, add VITE_PORT in .env"); } return { plugins: [react()], server: { port, strictPort: true, }, }; });