You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

76 lines
2.3 KiB
TypeScript

import {defineConfig} from 'vite'
import vue from '@vitejs/plugin-vue'
import {resolve} from 'path'
import AutoImport from 'unplugin-auto-import/vite'
// https://vitejs.dev/config/
export default defineConfig({
plugins: [
vue({
template: {
compilerOptions: {
// 将 micro-app 标签作为自定义元素处理
isCustomElement: tag => tag.startsWith('micro-app')
}
}
}),
AutoImport({
imports: [
'vue',
'vue-router',
'pinia',
],
dts: 'src/auto-imports.d.ts',
eslintrc: {
enabled: false,
},
}),
],
resolve: {
alias: {
'@': resolve(__dirname, 'src'),
},
},
server: {
port: 3000,
host: '0.0.0.0',
proxy: {
// flow-app 子应用代理
'/flowapp': {
target: 'http://localhost:9222',
changeOrigin: true,
},
// databuilder 数据工厂服务
'/api/databuilder': {
target: 'http://192.168.8.131:29380',
changeOrigin: true,
rewrite: path => path.replace(/^\/api\/databuilder/, '')
},
// console API (dify agents 服务)
'/api/console': {
target: 'http://192.168.8.122:12800/console',
changeOrigin: true,
rewrite: path => path.replace(/^\/api\/console/, '')
},
// 通用 API
'/api': {
target: 'http://192.168.8.207:8084/api',
changeOrigin: true,
rewrite: path => path.replace(/^\/api/, '')
},
// 文件存储服务
'/storage': {
target: 'http://192.168.8.207:8084/storage',
changeOrigin: true,
rewrite: path => path.replace(/^\/storage/, '')
},
// 文件预览服务
'/kkpreview': {
target: 'http://192.168.8.207:8084/kkpreview',
changeOrigin: true,
rewrite: path => path.replace(/^\/kkpreview/, '')
},
},
},
})