Why: U4 acceptance requires real-browser runs of the trace/audit workspace; the repo had only a manual .playwright.ts stub gated on PLAYWRIGHT_BASE_URL with no config, deps, or service wiring. Evidence: config/deps/spec staged; full run driven by Dev-side scripts/e2e.sh (seed-only smoke in progress in this task branch). Impact: dev-only additions (@playwright/test devDep, preview proxy segment, e2e/rdm-audit.playwright.ts); no production bundle changes. Refs: Dev task feature/rdm-e2e-acceptance; U4 in modules/documents/docs/proposals/2026-10-11-rdm-two-trees-trace-audit-integration.md
31 lines
1.1 KiB
TypeScript
31 lines
1.1 KiB
TypeScript
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', 'dompurify'],
|
||
},
|
||
server: {
|
||
port: 5173,
|
||
proxy: {
|
||
'/api': { target: 'http://127.0.0.1:8787', changeOrigin: false },
|
||
},
|
||
},
|
||
// E2E(U4 运行验收):preview 服务 dist 并把 /api 代理到被测后端(e2e.sh 注入
|
||
// PLAYWRIGHT_API_TARGET;缺省与 dev 代理同值,本地 npm run preview 也保持可用)。
|
||
preview: {
|
||
port: Number(process.env.PLAYWRIGHT_PREVIEW_PORT || 4173),
|
||
proxy: {
|
||
'/api': { target: process.env.PLAYWRIGHT_API_TARGET || 'http://127.0.0.1:8787', changeOrigin: false },
|
||
},
|
||
},
|
||
test: { environment: 'node' },
|
||
})
|