72 lines
2.1 KiB
TypeScript
72 lines
2.1 KiB
TypeScript
import { defineConfig } from "vite";
|
|
import react from "@vitejs/plugin-react";
|
|
import { fileURLToPath, URL } from "node:url";
|
|
export default defineConfig({
|
|
plugins: [react()],
|
|
resolve: {
|
|
alias: {
|
|
"@": fileURLToPath(new URL("./src", import.meta.url))
|
|
}
|
|
},
|
|
build: {
|
|
chunkSizeWarningLimit: 700,
|
|
rollupOptions: {
|
|
output: {
|
|
manualChunks(id) {
|
|
if (!id.includes("node_modules")) {
|
|
return undefined;
|
|
}
|
|
|
|
const normalizedId = id.replaceAll("\\", "/");
|
|
|
|
if (id.includes("node_modules/react/") || id.includes("node_modules/react-dom/") || id.includes("node_modules/scheduler/")) {
|
|
return "vendor-react";
|
|
}
|
|
|
|
if (normalizedId.includes("node_modules/react-router/") || normalizedId.includes("node_modules/react-router-dom/")) {
|
|
return "vendor-router";
|
|
}
|
|
|
|
if (normalizedId.includes("node_modules/i18next/") || normalizedId.includes("node_modules/react-i18next/") || normalizedId.includes("node_modules/i18next-browser-languagedetector/")) {
|
|
return "vendor-i18n";
|
|
}
|
|
|
|
if (normalizedId.includes("node_modules/axios/")) {
|
|
return "vendor-http";
|
|
}
|
|
|
|
if (normalizedId.includes("node_modules/zustand/")) {
|
|
return "vendor-state";
|
|
}
|
|
|
|
if (normalizedId.includes("node_modules/rc-") || normalizedId.includes("node_modules/@rc-component/")) {
|
|
return "vendor-rc";
|
|
}
|
|
|
|
if (id.includes("node_modules/jspdf/") || id.includes("node_modules/react-markdown/") || id.includes("node_modules/remark-") || id.includes("node_modules/rehype-") || id.includes("node_modules/unified/")) {
|
|
return "vendor-docs";
|
|
}
|
|
|
|
if (id.includes("node_modules/@dnd-kit/")) {
|
|
return "vendor-dnd";
|
|
}
|
|
|
|
return undefined;
|
|
}
|
|
}
|
|
}
|
|
},
|
|
server: {
|
|
port: 5174,
|
|
proxy: {
|
|
"/auth": "http://localhost:8080",
|
|
"/sys": "http://localhost:8080",
|
|
"/api": "http://localhost:8080",
|
|
"/ws": {
|
|
target: "ws://localhost:8080",
|
|
ws: true
|
|
}
|
|
}
|
|
}
|
|
});
|