import { defineConfig, loadEnv } from "vite"; import vue from "@vitejs/plugin-vue"; import { VitePWA } from "vite-plugin-pwa"; import { fileURLToPath, URL } from "node:url"; export default defineConfig(({ mode }) => { const env = loadEnv(mode, process.cwd(), ""); const apiTarget = env.VITE_API_PROXY_TARGET || "http://127.0.0.1:3000"; return { plugins: [ vue(), VitePWA({ registerType: "autoUpdate", manifest: { name: "Email Unlimit", short_name: "EmailUnlimit", description: "Private temporary mailbox workspace", theme_color: "#20231f", icons: [ { src: "icons/icon.svg", sizes: "any", type: "image/svg+xml", }, ], }, }), ], resolve: { alias: { "@": fileURLToPath(new URL("./src", import.meta.url)), }, }, server: { proxy: { "/auth": { target: apiTarget, changeOrigin: true, }, "/api": { target: apiTarget, changeOrigin: true, ws: true, }, "/health": { target: apiTarget, changeOrigin: true, }, }, }, }; });