MCSManager/frontend/vite.config.ts

82 lines
2.0 KiB
TypeScript
Raw Normal View History

2023-08-20 22:57:10 +08:00
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";
}
}
}
}
},
2023-08-20 23:38:22 +08:00
server: {
proxy: {
"/api": {
target: "http://localhost:23333",
2023-08-28 14:41:21 +08:00
changeOrigin: true,
ws: true
2023-11-29 22:48:06 +08:00
},
"/upload_files": {
target: "http://localhost:23333",
changeOrigin: true
2023-08-28 14:41:21 +08:00
},
"/socket.io": {
target: "ws://localhost:23333",
ws: true
2023-08-20 23:38:22 +08:00
}
}
},
2023-08-20 22:57:10 +08:00
plugins: [
vue(),
vueJsx(),
Components({
resolvers: [
AntDesignVueResolver({
2023-08-20 23:38:22 +08:00
importStyle: false // css in js
})
]
})
2023-08-20 22:57:10 +08:00
],
resolve: {
alias: {
2023-09-05 16:03:00 +08:00
"@": fileURLToPath(new URL("./src", import.meta.url)),
"@languages": fileURLToPath(new URL("../languages", import.meta.url))
2023-08-20 23:38:22 +08:00
}
}
2023-08-20 22:57:10 +08:00
});