Files
geo/apps/ops-web/vite.config.ts
T
root f5254f6a27 feat(ops-web): add operations console frontend
Vue 3 + Ant Design Vue SPA scaffold for the internal ops console. Ships
the auth, account list, and audit log views that consume the new ops-api
endpoints, plus the nginx/vite/typecheck plumbing.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-28 11:33:17 +08:00

60 lines
1.6 KiB
TypeScript

import { fileURLToPath, URL } from "node:url";
import vue from "@vitejs/plugin-vue";
import { defineConfig, loadEnv } from "vite";
const r = (path: string) => fileURLToPath(new URL(path, import.meta.url));
export default defineConfig(({ mode }) => {
const env = loadEnv(mode, ".", "");
const isProd = mode === "production";
return {
plugins: [vue()],
resolve: {
alias: {
"@": r("./src"),
},
},
server: {
host: "0.0.0.0",
port: 5174,
proxy: {
"/api": {
target: env.VITE_OPS_API_PROXY_TARGET || "http://localhost:8090",
changeOrigin: true,
},
},
},
esbuild: isProd ? { drop: ["console", "debugger"] } : undefined,
build: {
target: "es2022",
sourcemap: "hidden",
cssCodeSplit: true,
reportCompressedSize: false,
rollupOptions: {
output: {
entryFileNames: "assets/js/[name]-[hash].js",
chunkFileNames: "assets/js/[name]-[hash].js",
assetFileNames: "assets/[name]-[hash][extname]",
manualChunks(id) {
if (!id.includes("node_modules")) return undefined;
if (id.includes("/ant-design-vue/") || id.includes("/@ant-design/")) {
return "antd";
}
if (
id.includes("/vue/") ||
id.includes("/@vue/") ||
id.includes("/vue-router/") ||
id.includes("/pinia/")
) {
return "vue-vendor";
}
return "vendor";
},
},
},
},
};
});