Files
actual/packages/component-library/vitest.web.config.ts
74ffe101b4 [AI] Run React Compiler on js/ts files in addition to jsx/tsx (#8650)
The React Compiler include regex only matched .jsx/.tsx, so hooks and
components defined in plain .ts/.js files were never compiled. The babel
plugin already selects the TypeScript parser for .ts files, and the
compiler's code pre-filter keeps non-React files cheap to skip, so
widening the include to .[jt]sx? is all that's needed.


Claude-Session: https://claude.ai/code/session_013D6rbX4YueKKPZing9DRgm

Co-authored-by: Claude <noreply@anthropic.com>
2026-08-06 06:53:22 +00:00

38 lines
1.0 KiB
TypeScript

import babel from '@rolldown/plugin-babel';
import react, { reactCompilerPreset } from '@vitejs/plugin-react';
import { defineConfig } from 'vitest/config';
// Any workspace package's source; node_modules stays excluded by the babel
// plugin's default exclude.
const reactCompilerInclude =
/[\\/]packages[\\/][^\\/]+[\\/]src[\\/].*\.[jt]sx?(?:$|\?)/;
export default defineConfig({
test: {
environment: 'jsdom',
globals: true,
include: ['src/**/*.web.test.(js|jsx|ts|tsx)'],
maxWorkers: 2,
reporters: process.env.CI
? [
'default',
[
'junit',
{
outputFile: './test-results/junit-web.xml',
suiteName: 'component-library (web)',
},
],
]
: ['default'],
},
plugins: [
react(),
babel({
include: [reactCompilerInclude],
// n.b. Must be a string to ensure plugin resolution order. See https://github.com/actualbudget/actual/pull/5853
presets: [reactCompilerPreset()],
}),
],
});