37 lines
1.2 KiB
TypeScript
37 lines
1.2 KiB
TypeScript
import { fileURLToPath, URL } from "node:url";
|
|
|
|
import vue from "@vitejs/plugin-vue";
|
|
import { defineConfig, loadEnv } from "vite";
|
|
|
|
export default defineConfig(({ mode }) => {
|
|
const env = loadEnv(mode, process.cwd(), "");
|
|
const nativeApiUrl = String(env.WORKBENCH_NATIVE_API_URL ?? "").trim();
|
|
return {
|
|
plugins: [vue()],
|
|
resolve: {
|
|
alias: {
|
|
"@": fileURLToPath(new URL("./src", import.meta.url))
|
|
}
|
|
},
|
|
server: {
|
|
host: env.WORKBENCH_WEB_HOST || "127.0.0.1",
|
|
port: Number(env.WORKBENCH_WEB_PORT || 5173),
|
|
strictPort: true,
|
|
watch: env.WORKBENCH_VITE_USE_POLLING === "1" ? { usePolling: true, interval: 500 } : undefined,
|
|
proxy: nativeApiUrl ? { "/v1": { target: nativeApiUrl, changeOrigin: false }, "/auth": { target: nativeApiUrl, changeOrigin: false }, "/health": { target: nativeApiUrl, changeOrigin: false } } : undefined
|
|
},
|
|
build: {
|
|
outDir: "dist",
|
|
emptyOutDir: true,
|
|
sourcemap: false,
|
|
rollupOptions: {
|
|
output: {
|
|
entryFileNames: "app.js",
|
|
chunkFileNames: "assets/[name].js",
|
|
assetFileNames: "assets/[name][extname]"
|
|
}
|
|
}
|
|
}
|
|
};
|
|
});
|