oh-my-muse/muse-studio/vite.config.ts
lili 985a7ac0d8 feat(studio): B5b planning 编辑器组件 + 修复 vitest jsx runtime[P1]
- PlanningEditor.tsx:按 projection.fieldType 动态渲染(enum→select/number→number/boolean→checkbox/text→textarea);edits-diff pattern(字段值=编辑优先否则已存值,避免 effect setState 级联渲染);保存收集有值字段为 content+usedFieldKeys,成功清编辑。

- vite.config.ts:esbuild.jsx='automatic'。修复 vitest 默认 classic jsx runtime(需 React in scope)与生产 plugin-react/tsconfig react-jsx 不一致——此前仅 renderHook 测试未暴露,PlanningEditor 首个 render 组件测试触发 'React is not defined'。

验证:vitest PlanningEditor 2/2、全量 64/64、eslint clean、tsc 0 error。

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-21 02:53:22 -07:00

42 lines
1.1 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 'vite'
import react from '@vitejs/plugin-react'
import path from 'path'
// https://vite.dev/config/
export default defineConfig({
plugins: [react()],
// vitest 走 esbuild transform默认 classic jsx runtime需 React in scope
// 显式设 automatic与生产 plugin-react / tsconfig react-jsx 一致,组件文件无需手动 import React。
esbuild: {
jsx: 'automatic',
},
resolve: {
alias: {
'@': path.resolve(__dirname, 'src'),
},
},
server: {
port: 5173,
proxy: {
'/app-api': {
target: 'http://localhost:48080',
changeOrigin: true,
},
},
},
// @ts-expect-error - vitest types are not loaded globally in vite config
test: {
globals: true,
environment: 'jsdom',
setupFiles: ['./src/test/setup.ts'],
css: true,
include: ['src/**/*.test.{ts,tsx}'],
coverage: {
provider: 'v8',
reporter: ['text', 'html'],
include: ['src/**/*.{ts,tsx}'],
exclude: ['src/**/*.test.{ts,tsx}', 'src/types/**', 'src/test/**'],
},
},
})