ai-chat-ui/vite.config.ts

61 lines
1.3 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import { resolve } from "path";
import UnoCSS from "unocss/vite";
export default defineConfig({
plugins: [vue(), UnoCSS()],
// 基础路径
base: "/chat-ui/",
resolve: {
alias: {
"@": resolve(__dirname, "src"),
},
},
server: {
host: "0.0.0.0",
proxy: {
"/api/chat-ui": {
target: "http://localhost:8000", // Python服务器端口
changeOrigin: true,
},
},
},
build: {
// 输出目录
outDir: "dist",
// 静态资源目录
assetsDir: "assets",
// 生成 sourcemap生产环境可关闭
sourcemap: false,
// 使用 esbuild 压缩(默认,更快)
minify: "esbuild",
// 分包策略
rollupOptions: {
output: {
manualChunks: {
"vue-vendor": ["vue", "pinia"],
"ui-vendor": ["lucide-vue-next"],
},
chunkFileNames: "assets/js/[name]-[hash].js",
entryFileNames: "assets/js/[name]-[hash].js",
assetFileNames: "assets/[ext]/[name]-[hash].[ext]",
},
},
},
css: {
preprocessorOptions: {
scss: {
additionalData: ``,
},
},
},
});