Skip to content

FE-866: Use Vite native React Compiler - #9372

Merged
kube merged 2 commits into
mainfrom
codex/native-react-compiler
Aug 28, 2026
Merged

FE-866: Use Vite native React Compiler#9372
kube merged 2 commits into
mainfrom
codex/native-react-compiler

Conversation

@kube

@kube kube commented Aug 27, 2026

Copy link
Copy Markdown
Collaborator

🌟 What is the purpose of this PR?

Use Vite's native Oxc-based React Compiler integration now that it is available in @vitejs/plugin-react, removing the separate Babel transform from the affected Petrinaut builds.

🔗 Related links

🚫 Blocked by

  • Nothing

🔍 What does this change?

  • Upgrades @vitejs/plugin-react from 6.0.1 to 6.1.0 in @apps/petrinaut-website, @hashintel/petrinaut, and @hashintel/refractive.
  • Replaces @rolldown/plugin-babel and babel-plugin-react-compiler with oxc-transform-react 0.145.0.
  • Moves the existing React Compiler options onto the Vite React plugin's native compiler option.
  • Excludes generated .d.ts files in the two library builds so the native transform does not interfere with rolldown-plugin-dts output.
  • Keeps the existing exclusions for prebuilt workspace output and @hashintel/ds-components.

Build performance compared with main

Package Main median Native compiler median Peak RSS change
@hashintel/refractive 1.32s 1.05s
@hashintel/petrinaut 10.72s 6.35s approximately 17% lower
@apps/petrinaut-website 9.16s 3.47s approximately 46% lower

Pre-Merge Checklist 🚀

🚢 Has this modified a publishable library?

This PR:

  • does not modify any publishable blocks or libraries, or modifications do not need publishing

📜 Does this require a change to the docs?

The changes in this PR:

  • are internal and do not require a docs change

🕸️ Does this require a change to the Turbo Graph?

The changes in this PR:

  • do not affect the execution graph

⚠️ Known issues

The native compiler emits non-fatal experimental bailout diagnostics for some existing Petrinaut components and hooks. Those files remain valid and are skipped by the compiler where unsupported; builds complete successfully with panicThreshold: "critical_errors".

🐾 Next steps

  • Consider reducing the remaining compiler bailout diagnostics independently where the refactors improve the source code.

🛡 What tests cover this?

  • yarn install --immutable
  • yarn constraints
  • yarn lint:format
  • yarn exec turbo run build --filter @apps/petrinaut-website
  • TypeScript and lint checks for all three affected packages
  • 202 Petrinaut unit tests
  • 2 Petrinaut website unit tests

❓ How to test this?

  1. Install dependencies with the immutable lockfile.
  2. Build the three affected packages through Turborepo.
  3. Confirm the builds complete and the expected non-fatal Oxc bailout diagnostics do not become critical errors.

@vercel

vercel Bot commented Aug 27, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
petrinaut Ready Ready Preview Aug 27, 2026 12:45pm
3 Skipped Deployments
Project Deployment Actions Updated (UTC)
hash Ignored Ignored Preview Aug 27, 2026 12:45pm
hashdotdesign-tokens Ignored Ignored Preview Aug 27, 2026 12:45pm
petrinaut-docs Ignored Ignored Preview Aug 27, 2026 12:45pm

Request Review

@kube
kube marked this pull request as ready for review August 27, 2026 05:06
@github-actions github-actions Bot added area/deps Relates to third-party dependencies (area) area/infra Relates to version control, CI, CD or IaC (area) area/libs Relates to first-party libraries/crates/packages (area) type/eng > frontend Owned by the @frontend team area/apps labels Aug 27, 2026
@cursor

cursor Bot commented Aug 27, 2026

Copy link
Copy Markdown

PR Summary

Medium Risk
Build-time behavior changes for all compiled React in three packages; runtime output should match but compiler bailouts and edge-case transforms differ from Babel until validated in CI and manual builds.

Overview
Switches petrinaut-website, @hashintel/petrinaut, and @hashintel/refractive from a separate Babel React Compiler pipeline to @vitejs/plugin-react 6.1.0’s built-in compiler option backed by oxc-transform-react.

Dependencies: drops @rolldown/plugin-babel and babel-plugin-react-compiler; bumps the React plugin and lockfile accordingly. Petrinaut docs now reference Oxc instead of Babel for the compiler stack.

Vite config: each app/library uses a single react({ compiler: { target: "19", compilationMode: "infer", panicThreshold: "critical_errors" } }) plugin instead of react() + babel({ presets: [reactCompilerPreset(...)] }). Existing exclude rules are preserved or tightened: @hashintel/ds-components / prebuilt jsx() output on the website and petrinaut builds; library builds also skip \.d\.ts$ so rolldown-plugin-dts output is not run through the native transform.

Reviewed by Cursor Bugbot for commit 85eeab9. Bugbot is set up for automated code reviews on this repo. Configure here.

@kube
kube added this pull request to the merge queue Aug 28, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Aug 28, 2026
@kube
kube added this pull request to the merge queue Aug 28, 2026
Merged via the queue into main with commit 88d0932 Aug 28, 2026
61 checks passed
@kube
kube deleted the codex/native-react-compiler branch August 28, 2026 11:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/apps area/deps Relates to third-party dependencies (area) area/infra Relates to version control, CI, CD or IaC (area) area/libs Relates to first-party libraries/crates/packages (area) type/eng > frontend Owned by the @frontend team

Development

Successfully merging this pull request may close these issues.

2 participants