From bba9b4687b7d009c14805a7d5daca91a122d5674 Mon Sep 17 00:00:00 2001 From: Oliver Dudgeon <22367286+OliverDudgeon@users.noreply.github.com> Date: Fri, 28 Aug 2026 10:47:21 +0100 Subject: [PATCH] feat: compile the application with the React Compiler Turns the React Compiler on as its native Rust port inside Turbopack, so there is no Babel plugin and no new dependency. `next.config.mjs` sets `reactCompiler: true` and `experimental.turbopackRustReactCompiler: true`, introduced in Next 16.3. Per the option's docs this runs the compiler as native code inside Turbopack, which `dev` already builds and serves with, so `babel-plugin-react-compiler` is not needed. The same docs state the option is only supported with Turbopack and throws under webpack, so the three `analyze` scripts give up their remaining `--webpack` pin. Builds on the compatibility work that turned on every `eslint-plugin-react-hooks` v7 diagnostic and cleared the tree, so no component is silently skipped. Co-Authored-By: Claude Opus 5 (1M context) --- AGENTS.md | 2 +- next.config.mjs | 10 ++++++++++ package.json | 6 +++--- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index 3b66901ca..4979bfb74 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -18,7 +18,7 @@ The app has its own git repository (InformaticsMatters/squonk2-data-manager-ui), ## Commands -- `pnpm dev` — dev server (Turbopack). +- `pnpm dev` — dev server (Turbopack, which the React Compiler's Rust port requires). - `pnpm build` — production build. Run the separate strict TypeScript and ESLint commands too. - `pnpm generate:client:data-manager` / `pnpm generate:client:account-server` — regenerate one local OpenAPI client from its ignored input in `openapi/`. - `pnpm generate:clients` — transactionally regenerate both local OpenAPI clients. diff --git a/next.config.mjs b/next.config.mjs index a7a3dc581..df18edfe2 100644 --- a/next.config.mjs +++ b/next.config.mjs @@ -40,6 +40,16 @@ let nextConfig = { : /** @type {import("next").NextConfig["output"]} */ (process.env.OUTPUT_TYPE), generateBuildId: process.env.GIT_SHA ? () => process.env.GIT_SHA ?? null : undefined, typescript: { ignoreBuildErrors: true }, + // Every rule the compiler's own diagnostics ship as is enabled in `eslint.config.mjs`, so the + // tree is kept in the shape the compiler can actually compile rather than silently skipping + // components it cannot. + reactCompiler: true, + experimental: { + // The native Rust port of the React Compiler, which runs inside Turbopack rather than as a + // Babel pass through Node. This is why the build is Turbopack rather than webpack: the option + // errors outright under webpack. + turbopackRustReactCompiler: true, + }, // reactStrictMode: true, // TODO: Blocked by @rjsf Form using UNSAFE_componentWillReceiveProps pageExtensions: ["js", "ts", "jsx", "tsx", "mdx"], // The redesign is a clean cutover: a removed route is the ordinary not-found, so this diff --git a/package.json b/package.json index 3df90265f..5c877a008 100644 --- a/package.json +++ b/package.json @@ -33,9 +33,9 @@ "test:smoke": "playwright test --config=playwright.smoke.config.ts", "test:debug": "pnpm test:acceptance:headed", "test:ci": "pnpm test", - "analyze": "ANALYZE=true next build --webpack", - "analyze:server": "BUNDLE_ANALYZE=server next build --webpack", - "analyze:browser": "BUNDLE_ANALYZE=browser next build --webpack" + "analyze": "ANALYZE=true next build", + "analyze:server": "BUNDLE_ANALYZE=server next build", + "analyze:browser": "BUNDLE_ANALYZE=browser next build" }, "lint-staged": { "*.@(js|ts|tsx)": [