Files

57 lines
1.6 KiB
TypeScript
Raw Permalink 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.
// =============================================================================
// 企微IT智能服务台 — 管理后台 Vite 配置
// =============================================================================
// 说明:Vite 构建工具配置,定义开发服务器、构建输出等
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
// Vite 配置
// https://vitejs.dev/config/
export default defineConfig({
// 生产环境基础路径(部署在 /itadmin/ 子路径下,与IT数据平台共享域名)
base: '/itadmin/',
// Vue3 插件
plugins: [vue()],
// 开发服务器配置
server: {
// 开发服务器端口
// 5173 = 坐席端(frontend-agent)5174 = H5用户端(frontend-h5)5175 = 管理后台
port: 5175,
// 自动打开浏览器
open: true,
// API 代理:将 /api 请求转发到后端,解决开发环境跨域问题
proxy: {
'/api': {
target: 'http://localhost:8000',
changeOrigin: true,
// 本地开发剥离 /api 前缀,因为后端路由不包含 /api(生产 nginx 负责剥离)
rewrite: (path) => path.replace(/^\/api/, ''),
},
// WebSocket 代理:将 /ws 请求转发到后端 WebSocket 服务
'/ws': {
target: 'ws://localhost:8000',
ws: true,
},
},
},
// 构建配置
build: {
// 输出目录
outDir: 'dist',
// 静态资源内联阈值(小于4KB的资源会被base64内联)
assetsInlineLimit: 4096,
},
// 路径别名
resolve: {
alias: {
// 使用 @ 指向 src 目录,方便导入
'@': '/src',
},
},
})