import { fileURLToPath } from 'node:url'; import { defineConfig } from 'vitest/config'; import react from '@vitejs/plugin-react'; export default defineConfig({ plugins: [react()], resolve: { alias: { // @proposal-system/api-contracts has no `exports` map (main points at // src/index.ts), so the /schemas subpath entrypoint needs an explicit // alias for vitest's resolver (mirrors the tsconfig `paths` mapping). '@proposal-system/api-contracts/schemas': fileURLToPath( new URL('../shared/api-contracts/src/schemas.ts', import.meta.url) ), }, }, test: { environment: 'jsdom', globals: true, setupFiles: ['./src/test/setup.ts'], include: ['src/**/*.test.{ts,tsx}'], server: { deps: { // MUI v9's ESM build (Transition.mjs) does a directory import of // react-transition-group/TransitionGroupContext, which Node's native // ESM loader can't resolve. Inline these so Vite resolves them. inline: [/@mui\/material/, 'react-transition-group'], }, }, }, });