mirror of
https://github.com/MCSManager/MCSManager.git
synced 2024-12-15 07:40:01 +08:00
177697f906
Improve chunking by split chunks into several small chunks. It improves loading performance.
82 lines
2.0 KiB
TypeScript
82 lines
2.0 KiB
TypeScript
import { fileURLToPath, URL } from "node:url";
|
|
|
|
import { defineConfig } from "vite";
|
|
import vue from "@vitejs/plugin-vue";
|
|
import vueJsx from "@vitejs/plugin-vue-jsx";
|
|
import Components from "unplugin-vue-components/vite";
|
|
import { AntDesignVueResolver } from "unplugin-vue-components/resolvers";
|
|
|
|
// https://vitejs.dev/config/
|
|
export default defineConfig({
|
|
build: {
|
|
rollupOptions: {
|
|
output: {
|
|
manualChunks(id) {
|
|
if (id.includes("node_modules/ant-design-vue/es")) {
|
|
return "ant-es";
|
|
}
|
|
if (id.includes("node_modules/ant-design-vue")) {
|
|
return "ant";
|
|
}
|
|
if (id.includes("node_modules/echarts")) {
|
|
return "echart";
|
|
}
|
|
if (id.includes("node_modules/zrender")) {
|
|
return "zrender";
|
|
}
|
|
if (id.includes("node_modules/vue")||id.includes("node_modules/@vue")) {
|
|
return "vue";
|
|
}
|
|
if (id.includes("node_modules/xterm")) {
|
|
return "xterm";
|
|
}
|
|
if (id.includes("node_modules/@codemirror")) {
|
|
return "codemirror";
|
|
}
|
|
if (id.includes("node_modules/monaco")) {
|
|
return "monaco";
|
|
}
|
|
if (id.includes("languages")) {
|
|
return "lang";
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
server: {
|
|
proxy: {
|
|
"/api": {
|
|
target: "http://localhost:23333",
|
|
changeOrigin: true,
|
|
ws: true
|
|
},
|
|
"/upload_files": {
|
|
target: "http://localhost:23333",
|
|
changeOrigin: true
|
|
},
|
|
"/socket.io": {
|
|
target: "ws://localhost:23333",
|
|
ws: true
|
|
}
|
|
}
|
|
},
|
|
|
|
plugins: [
|
|
vue(),
|
|
vueJsx(),
|
|
Components({
|
|
resolvers: [
|
|
AntDesignVueResolver({
|
|
importStyle: false // css in js
|
|
})
|
|
]
|
|
})
|
|
],
|
|
resolve: {
|
|
alias: {
|
|
"@": fileURLToPath(new URL("./src", import.meta.url)),
|
|
"@languages": fileURLToPath(new URL("../languages", import.meta.url))
|
|
}
|
|
}
|
|
});
|