56 lines
1.5 KiB
TypeScript
56 lines
1.5 KiB
TypeScript
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(networkingMode=mirrored)里,uvicorn 必须以
|
||
// --host 0.0.0.0 启动,Windows 的 localhost 才能到达它。详见 UI测试手册第 0 节。
|
||
'/modelTF': {
|
||
target: 'http://localhost:17861',
|
||
changeOrigin: true,
|
||
},
|
||
},
|
||
},
|
||
})
|