Files
YG_FT/frontend/vite.config.ts
wangjiming 945b4ace86 update
2026-07-30 14:38:56 +08:00

56 lines
1.6 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 AutoImport from 'unplugin-auto-import/vite'
import Components from 'unplugin-vue-components/vite'
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
import path from 'node:path'
// https://vite.dev/config/
export default defineConfig({
plugins: [
vue(),
AutoImport({
resolvers: [ElementPlusResolver({ importStyle: false })],
}),
Components({
resolvers: [ElementPlusResolver({ importStyle: false })],
}),
],
resolve: {
alias: {
'@': path.resolve(__dirname, 'src'),
},
},
optimizeDeps: {
// 预先打包常用依赖,避免首次路由懒加载时即兴打包触发整页 reload表现为「点一下没反应过会儿自己跳好」
include: [
'vue',
'vue-router',
'pinia',
'axios',
'element-plus',
'element-plus/es',
'@element-plus/icons-vue',
'echarts',
'vue-echarts',
'@vueuse/core',
'chart.js',
'marked',
'dompurify',
'md-editor-v3',
],
},
server: {
port: 16801,
proxy: {
// Frontend uses /modelTF and proxies to the local five-digit backend port.
// 后端跑在 WSL2 默认NAT网络下Windows 的 localhost 经 localhostForwarding 转发到 WSL
// 后端以 --host 0.0.0.0 启动即可。不要用 networkingMode=mirrored本机镜像回环对 WSL 服务失效)。
'/modelTF': {
target: 'http://localhost:17861',
changeOrigin: true,
},
},
},
})