2026-08-04 10:05:59 +08:00
|
|
|
import { defineConfig } from "vite";
|
|
|
|
|
import react from "@vitejs/plugin-react";
|
|
|
|
|
import tailwindcss from "@tailwindcss/vite";
|
2026-08-04 17:09:51 +08:00
|
|
|
import basicSsl from "@vitejs/plugin-basic-ssl";
|
2026-08-04 10:05:59 +08:00
|
|
|
|
|
|
|
|
// https://vite.dev/config/
|
|
|
|
|
export default defineConfig({
|
2026-08-04 17:09:51 +08:00
|
|
|
plugins: [react(), tailwindcss(), basicSsl()],
|
2026-08-04 10:05:59 +08:00
|
|
|
|
2026-08-06 17:34:00 +08:00
|
|
|
// 🚀 构建优化:将第三方巨头独立分包,利用浏览器缓存
|
|
|
|
|
build: {
|
|
|
|
|
rollupOptions: {
|
|
|
|
|
output: {
|
|
|
|
|
manualChunks: {
|
|
|
|
|
"vendor-react": ["react", "react-dom", "react-router-dom"],
|
|
|
|
|
"vendor-antd": ["antd", "@ant-design/icons"],
|
|
|
|
|
"vendor-qrcode": ["html5-qrcode"],
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
|
2026-08-04 10:05:59 +08:00
|
|
|
clearScreen: false,
|
|
|
|
|
server: {
|
2026-08-04 17:09:51 +08:00
|
|
|
host: "0.0.0.0",
|
2026-08-04 10:05:59 +08:00
|
|
|
port: 1420,
|
|
|
|
|
strictPort: true,
|
2026-08-04 17:09:51 +08:00
|
|
|
// Docker on Windows/WSL 必须用 polling 才能检测到文件变化
|
2026-08-04 10:05:59 +08:00
|
|
|
watch: {
|
2026-08-04 17:09:51 +08:00
|
|
|
usePolling: true,
|
2026-08-04 10:05:59 +08:00
|
|
|
ignored: ["**/src-tauri/**"],
|
|
|
|
|
},
|
2026-08-04 17:09:51 +08:00
|
|
|
proxy: {
|
|
|
|
|
"/api": {
|
|
|
|
|
target: "http://backend:8000", // Docker 内部用服务名
|
|
|
|
|
changeOrigin: true,
|
|
|
|
|
},
|
|
|
|
|
},
|
2026-08-04 10:05:59 +08:00
|
|
|
},
|
|
|
|
|
});
|