Files
lingji-work-fe/vite.config.ts
林志军 9fa28c76cc refactor(Agent/Chat): 使用 cozeInfo 替代 botId 获取聊天记录
- 移除了 HistoryChat 组件中的 botId属性
- 使用 cozeInfo.bot_id 替代 botId 获取历史聊天数据
2025-07-24 19:07:46 +08:00

66 lines
1.5 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.

/*
* @Author: RenXiaoDong
* @Date: 2025-07-02 09:17:39
*/
import type { ConfigEnv, UserConfig } from 'vite';
import { defineConfig, loadEnv } from 'vite';
import vue from '@vitejs/plugin-vue';
import vueJsx from '@vitejs/plugin-vue-jsx';
import analyzer from 'rollup-plugin-visualizer';
import { pluginsConfig, setServerConfig, resolve } from './config';
export default defineConfig(({ mode }: ConfigEnv): UserConfig => {
const envDir = resolve('env');
const env = loadEnv(mode, envDir, '');
const setServer = setServerConfig({ env });
return {
css: {
preprocessorOptions: {
scss: {
// additionalData: `@import "@/styles/vars.css";`,
},
},
},
plugins: [vue(), vueJsx(), ...pluginsConfig, setAnalyzer(env.VITE_ENV)],
resolve: {
extensions: ['.jsx', '.tsx', '.js', '.ts', '.json', '.vue'],
alias: {
'@': resolve('src'),
'@components': resolve('src/components'),
},
},
envDir,
envPrefix: env.ENV_PREFIX,
server: {
proxy: {
'/api': {
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, ''),
// 目标地址
target: 'http://www.lingji.com/api',
},
},
},
preview: setServer(),
};
});
/**
* 设置分析器仅在development环境下生效
* @param env
* @returns
*/
function setAnalyzer(env = 'development') {
console.log('env: ', env);
if (env === 'development') {
return analyzer({
filename: 'analyzer.html',
open: true,
});
}
return null;
}