Files
hermes-agent/web/vitest.config.ts
Jaaneek 95057c2a63 feat(desktop,web): enable the React Compiler in both renderer builds
Wire babel-plugin-react-compiler through @vitejs/plugin-react v6's
reactCompilerPreset + @rolldown/plugin-babel in the web and desktop
vite configs, scoped to modules that can actually contain components
or hooks (JSX syntax or a react-ish import — the preset's default
filter babel-parsed every TS module). Both vitest configs run compiled
components, so rules-of-react violations fail in CI.

Also fixes the latent bug the compiler exposed: usePluginI18n kept a
stable translator identity over a mutating locale registry, so
memoized consumers (React.memo today, compiled components tomorrow)
served stale strings after a late bundle registration. The registry
version now keys the translator identity — correct with or without
the compiler.
2026-08-20 19:44:26 -07:00

25 lines
666 B
TypeScript

import { defineConfig } from "vitest/config";
import babel from "@rolldown/plugin-babel";
import react, { reactCompilerPreset } from "@vitejs/plugin-react";
/** Same component/hook-scoped compiler preset as vite.config.ts. */
function compilerPreset() {
const preset = reactCompilerPreset();
preset.rolldown.filter.code = /\/>|<\/|from\s*['"][^'"]*react/;
return preset;
}
import path from "path";
export default defineConfig({
plugins: [react(), babel({ presets: [compilerPreset()] })],
resolve: {
alias: {
"@": path.resolve(__dirname, "./src"),
},
},
test: {
environment: "node",
include: ["src/**/*.test.{ts,tsx}"],
},
});