2026-06-02 12:38:01 +08:00
|
|
|
import react from "@vitejs/plugin-react";
|
|
|
|
|
import { compression } from "vite-plugin-compression2";
|
2026-06-04 16:03:49 +08:00
|
|
|
import { defineConfig } from "vite";
|
2026-06-02 12:38:01 +08:00
|
|
|
|
2026-06-04 16:03:49 +08:00
|
|
|
export default defineConfig(() => ({
|
2026-06-02 18:31:39 +08:00
|
|
|
plugins: [
|
|
|
|
|
react(),
|
|
|
|
|
compression({ algorithms: ["gzip", "brotliCompress"], threshold: 1024 }),
|
|
|
|
|
],
|
|
|
|
|
server: {
|
2026-06-04 01:12:51 +08:00
|
|
|
port: 5173,
|
2026-06-02 18:31:39 +08:00
|
|
|
host: "127.0.0.1",
|
|
|
|
|
proxy: {
|
|
|
|
|
"/api": {
|
2026-06-04 01:12:51 +08:00
|
|
|
target: "https://omniai.net.cn",
|
2026-06-03 01:39:06 +08:00
|
|
|
changeOrigin: true,
|
|
|
|
|
},
|
2026-06-02 12:38:01 +08:00
|
|
|
},
|
|
|
|
|
},
|
2026-06-02 18:31:39 +08:00
|
|
|
preview: {
|
|
|
|
|
port: 4174,
|
|
|
|
|
host: "127.0.0.1",
|
|
|
|
|
},
|
|
|
|
|
esbuild: {
|
|
|
|
|
drop: ["console", "debugger"],
|
|
|
|
|
},
|
|
|
|
|
build: {
|
2026-06-04 19:00:50 +08:00
|
|
|
sourcemap: false,
|
2026-06-02 18:31:39 +08:00
|
|
|
rollupOptions: {
|
|
|
|
|
output: {
|
|
|
|
|
manualChunks(id: string) {
|
|
|
|
|
if (id.includes("node_modules/react") || id.includes("node_modules/react-dom") || id.includes("node_modules/scheduler")) {
|
|
|
|
|
return "vendor-react";
|
|
|
|
|
}
|
|
|
|
|
if (id.includes("node_modules/@ant-design") || id.includes("node_modules/antd") || id.includes("node_modules/rc-")) {
|
|
|
|
|
return "vendor-antd";
|
|
|
|
|
}
|
|
|
|
|
if (id.includes("node_modules/@xyflow")) {
|
|
|
|
|
return "vendor-xyflow";
|
|
|
|
|
}
|
|
|
|
|
},
|
2026-06-02 12:38:01 +08:00
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
2026-06-04 16:03:49 +08:00
|
|
|
}));
|