import { fileURLToPath } from 'node:url' import { defineConfig } from 'vite' import react from '@vitejs/plugin-react' // UI 组件库源码组合(modules/ui,源码级别名;见 Agent-System-Documents 提案 D29)。 const uiSrc = fileURLToPath(new URL('../ui/src', import.meta.url)) export default defineConfig({ plugins: [react()], resolve: { alias: [{ find: '@ui', replacement: uiSrc }], // 源码组合下 ui 仓有自己的 node_modules;dedupe 强制最终 bundle 用 frontend 的单副本。 dedupe: ['react', 'react-dom', 'marked'], }, server: { port: 5173, proxy: { '/api': { target: 'http://127.0.0.1:8787', changeOrigin: false }, }, }, test: { environment: 'node' }, })