perf(frontend): Vite 构建分包 — manualChunks 拆分 vendor

将 react/react-dom/react-router-dom → vendor-react
将 antd/@ant-design/icons → vendor-antd
将 html5-qrcode → vendor-qrcode
第三方巨头的独立 chunk 可被浏览器长期缓存,业务代码更新时无需重新下载。
This commit is contained in:
2026-08-06 17:34:00 +08:00
parent 3d164159ac
commit b725599cb0

View File

@ -7,6 +7,19 @@ import basicSsl from "@vitejs/plugin-basic-ssl";
export default defineConfig({
plugins: [react(), tailwindcss(), basicSsl()],
// 🚀 构建优化:将第三方巨头独立分包,利用浏览器缓存
build: {
rollupOptions: {
output: {
manualChunks: {
"vendor-react": ["react", "react-dom", "react-router-dom"],
"vendor-antd": ["antd", "@ant-design/icons"],
"vendor-qrcode": ["html5-qrcode"],
},
},
},
},
clearScreen: false,
server: {
host: "0.0.0.0",