Files
hzhub/hzhub-admin/apps/web-antd/vite.config.mts
大壮 2f25a943b8 feat: 添加项目配置和依赖更新
配置更新:
1. 前端配置
   - 添加 hook-fetch 依赖用于 HTTP 请求
   - 更新 vite.config.mts 配置
   - 添加 .npmrc 配置文件

2. 后端配置
   - 更新 application.yml 和 application-dev.yml 配置
   - 更新 docker-compose.yml 配置

3. 代码优化
   - OSS 客户端优化
   - SSE 管理器优化
   - 聊天服务和向量存储策略优化

4. 项目文档
   - 添加 CLAUDE.md 项目指南

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-02 09:44:56 +00:00

84 lines
2.4 KiB
TypeScript
Raw Permalink 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 { resolve } from 'path';
// 自行取消注释来启用按需导入功能
// import { AntDesignVueResolver } from 'unplugin-vue-components/resolvers';
// import Components from 'unplugin-vue-components/vite';
export default defineConfig(async () => {
return {
application: {},
vite: {
define: {
// 注入项目根路径到运行时ruoyi-admin目录层级
__PROJECT_ROOT__: JSON.stringify((() => {
const cwd = process.cwd();
console.log('Vite当前工作目录:', cwd);
// 规范化路径分隔符,统一处理 Windows 和 macOS/Linux
const normalizedPath = cwd.replace(/\\/g, '/');
// 如果当前目录包含 /apps/web-antd则向上两级到 ruoyi-admin
if (normalizedPath.includes('/apps/web-antd')) {
return resolve(cwd, '../..');
}
// 如果当前目录包含 /apps则向上一级到 ruoyi-admin
else if (normalizedPath.includes('/apps')) {
return resolve(cwd, '..');
}
// 否则返回当前目录
else {
return cwd;
}
})()),
},
// 解决 jiti 构建问题
optimizeDeps: {
include: ['jiti'],
},
ssr: {
noExternal: ['jiti'],
},
build: {
commonjsOptions: {
transformMixedEsModules: true,
},
rollupOptions: {
external: [
/node_modules\/jiti\//,
],
},
target: 'es2022',
},
plugins: [
// Components({
// dirs: [], // 默认会导入src/components目录下所有组件 不需要
// dts: './types/components.d.ts', // 输出类型文件
// resolvers: [
// AntDesignVueResolver({
// // 需要排除Button组件 全局已经默认导入了
// exclude: ['Button'],
// importStyle: false, // css in js
// }),
// ],
// }),
],
server: {
proxy: {
'/api': {
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, ''),
// mock代理目标地址
target: 'http://127.0.0.1:6039',
ws: true,
},
'/resource': {
changeOrigin: true,
target: 'http://127.0.0.1:6039',
},
},
},
},
};
});