Files
0c96d7701b [AI] Enable React Compiler for all monorepo packages with React code (#8463)
* [AI] Enable React Compiler for all monorepo packages with React code

The compiler was previously scoped to desktop-client/src only. Now:
- desktop-client's Vite build also compiles component-library source
  (consumed as raw source through the same build), covering web,
  desktop, and mobile bundles
- component-library's Storybook and Vitest pipelines apply the compiler
  so they exercise the same compiled output
- docs (Docusaurus) enables babel-plugin-react-compiler for the site's
  own React components

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PdcKq244khwKhedvLCwu7p

* [AI] Declare npm-run-all in component-library so its test script resolves

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PdcKq244khwKhedvLCwu7p

* [AI] Generalize React Compiler include to any workspace package source

Match packages/<name>/src instead of enumerating package names, so a
future workspace library with React components is compiled automatically.
Third-party code stays out via the babel plugin's default node_modules
exclude, which applies alongside a custom include.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PdcKq244khwKhedvLCwu7p

* [AI] Inline component-library test script instead of using npm-run-all

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PdcKq244khwKhedvLCwu7p

* [AI] Drop React Compiler from docs

The docs site is static content with a handful of simple components, so
auto-memoization buys nothing there, and an unscoped babel plugin would
also process Docusaurus theme code and every MDX page. Reverting keeps
the compiler where it pays off: desktop-client and component-library.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PdcKq244khwKhedvLCwu7p

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-07-14 07:15:20 +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()],
}),
],
});