Files
iotlcm/vue/apps/web-antd/vite.config.mts
T
MiFaZhan 3106d96ac7 chore: 初始开源发布
iotlcm-admin-ui:管理前端(基于 Vben Admin 5.5.9 二次开发)。

- 天地图 API Key → YOUR_TIANDITU_KEY
- OAuth 客户端 ID → your-client-id,store 加密密钥 → 提示自行替换
- Makefile 移除明文 registry 登录口令,镜像地址改
- appIcon 指向内网图床的链接 → /favicon.ico
- 真实手机号 → 合法 11 位编造号(保留号段前 3 位 + 后 4 位)
- 真实邮箱 → example.com(署名头内的上游作者邮箱保留)
- 移除 CI 触发器
- 补 MIT LICENSE(含 Vben Admin 上游声明)+ README
- 统一 LF 行尾并加 .gitattributes

上游 Vben Admin 的版权与许可声明完整保留(各源文件 @Author/@Copyright 头 + LICENSE)。
2026-10-26 13:46:34 +08:00

55 lines
1.6 KiB
TypeScript

import type { DefineConfig } from '@vben/vite-config/src/typing';
import process from 'node:process';
import { fileURLToPath } from 'node:url';
import { defineConfig } from '@vben/vite-config';
import { apiTypeGeneratorPlugin } from './plugins/api-type-generator';
const config: DefineConfig = async () => {
const proxyTarget =
process.env.VITE_DEV_PROXY_TARGET || 'http://localhost:8008';
return {
application: {},
vite: {
plugins: [
// 生成API类型文件
apiTypeGeneratorPlugin({
apiRoot: fileURLToPath(new URL('src/api', import.meta.url)),
}) as any,
],
server: {
allowedHosts: ['www.test.com'],
proxy: {
// 拉整个API文件
'/api.json': {
changeOrigin: true,
target: proxyTarget,
// target: 'http://iotlcm.example.com:8008', // 生产环境
},
// 正常API代理
'/api': {
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, ''),
target: `${proxyTarget}/api/v1`,
// target: 'http://iotlcm.example.com:8008/api/v1', // 生产环境
ws: true,
},
// 文件上传代理
'/upload': {
changeOrigin: true,
rewrite: (path) => path.replace(/^\/upload/, ''),
target: `${proxyTarget}/upload`,
// target: 'http://iotlcm.example.com:8008/upload', // 生产环境
ws: true,
},
},
},
},
};
};
export default defineConfig(config) as import('vite').UserConfigExport;