pansoft-plrl/apps/web-office/vite.config.mts

98 lines
2.9 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 '@vben/vite-config';
import { AntDesignVueResolver } from 'unplugin-vue-components/resolvers';
import Components from 'unplugin-vue-components/vite';
import AutoImport from 'unplugin-auto-import/vite'
import { lazyImport, VxeResolver } from 'vite-plugin-lazy-import'
export default defineConfig(async () => {
return {
application: {},
plugins: [
AutoImport({
// 自动导入 Vue 相关函数ref, reactive, toRef 等
imports: ['vue'],
include: [
/\.[tj]sx?$/,
/\.vue$/,
/\.vue\?vue/,
],
resolvers: [
// // 自动导入 Element Plus 相关函数ElMessage, ElMessageBox... (带样式)
// ElementPlusResolver(),
// // 自动导入图标组件
// IconsResolver({})
],
vueTemplate: true, // 是否在 vue 模板中自动导入
dts: true // (false) 配置文件生成位置,默认是根目录 /auto-imports.d.ts
}),
Components({
dts: true,
resolvers: [
AntDesignVueResolver({
importStyle: false, // css in js
}),
],
}),
lazyImport({
resolvers: [
VxeResolver({
libraryName: 'vxe-table'
}),
]
})
],
vite: {
server: {
host: '0.0.0.0',
open: false,
port: 9528,
proxy: {
'/api/app': {
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api\/app/, '/'),
// target: `http://10.71.220.24:8083/rl`,
target: `http://192.168.147.164:8083/rl`,
ws: true,
},
'/api/uc': {
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api\/uc/, '/'),
// target: `http://10.71.220.24:8082`,
target: `http://192.168.147.164:8082`,
ws: true,
},
'/api/czg/app': {
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api\/czg\/app/, '/'),
// mock代理目标地址
target: `http://10.71.221.222:8083/rl`,
ws: true,
},
'/api/czg/uc': {
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api\/czg\/uc/, '/'),
// mock代理目标地址
target: `http://10.71.220.24:8082`,
ws: true,
},
'/api/zp/app': {
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api\/zp\/app/, '/'),
// mock代理目标地址
target: `http://192.168.153.236:8083/rl`,
ws: true,
},
'/api/zp/uc': {
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api\/zp\/uc/, '/'),
// mock代理目标地址
target: `http://192.168.147.164:8082`,
ws: true,
},
},
},
},
};
});