mirror of
https://github.com/actualbudget/actual.git
synced 2026-11-09 10:45:04 -06:00
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>
38 lines
1.0 KiB
TypeScript
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()],
|
|
}),
|
|
],
|
|
});
|