// 剧游AI用户端 Vite 构建配置,配置 Vue 插件、路径别名、代理与输出目录 import { fileURLToPath, URL } from 'node:url' import { defineConfig } from 'vite' import vue from '@vitejs/plugin-vue' import { findAvailablePort } from '../vite-port' const devHost = '127.0.0.1' const devPort = await findAvailablePort(devHost, 5501) const apiProxy = { '/api': { target: 'http://127.0.0.1:8123', changeOrigin: true, }, } export default defineConfig({ base: '/', plugins: [vue()], resolve: { alias: { '@': fileURLToPath(new URL('./src', import.meta.url)), }, }, css: { preprocessorOptions: { scss: { api: 'modern-compiler', }, }, }, build: { outDir: '../API/static/web', emptyOutDir: true, }, server: { host: devHost, port: devPort, open: false, proxy: apiProxy, }, preview: { proxy: apiProxy, }, })