Commit 1582b695 authored by 高如斌's avatar 高如斌

拆包

parent 0db615a6
/*
* @Description:
* @Author: gaorubin
* @Date: 2025-12-22 14:30:43
* @LastEditors: gaorubin
* @LastEditTime: 2025-12-24 18:11:39
*/
import { defineConfig } from "vite"; import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue"; import vue from "@vitejs/plugin-vue";
import path from "path"; import path from "path";
...@@ -37,14 +30,14 @@ export default defineConfig({ ...@@ -37,14 +30,14 @@ export default defineConfig({
}, },
proxy: { proxy: {
"/api": { "/api": {
target: "http://localhost:8080", // target: "http://localhost:8080",
// target: "http://agent-backend.clouddev.hisense.com", target: "http://agent-backend.clouddev.hisense.com",
changeOrigin: true, changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, "/api"), rewrite: (path) => path.replace(/^\/api/, "/api"),
}, },
"/ws": { "/ws": {
target: "http://localhost:8080", // target: "http://localhost:8080",
// target: "http://agent-backend.clouddev.hisense.com", target: "http://agent-backend.clouddev.hisense.com",
ws: true, // 启用WebSocket代理 ws: true, // 启用WebSocket代理
changeOrigin: true, changeOrigin: true,
}, },
...@@ -54,6 +47,30 @@ export default defineConfig({ ...@@ -54,6 +47,30 @@ export default defineConfig({
target: "esnext", target: "esnext",
minify: "terser", minify: "terser",
sourcemap: false, sourcemap: false,
rollupOptions: {
output: {
manualChunks(id) {
if (id.includes("node_modules/echarts")) {
return "echarts";
}
if (id.includes("tinymce")) {
return "tinymce";
}
if (id.includes("@babel/standalone")) {
return "babel-standalone";
}
if (id.includes("pangea-component")) {
return "pangea-component";
}
/* !id.endsWith(".css") 是为了解决拆包后的样式问题 */
if (id.includes("pangea-ui") && !id.endsWith(".css")) {
return "pangea-ui";
}
return undefined;
// 其他模块的处理逻辑
},
},
},
}, },
esbuild: { esbuild: {
jsxFactory: "h", jsxFactory: "h",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment