Files
react/compiler/docs/DEVELOPMENT_GUIDE.md
T
Joe Savona 9eabb37338 [compiler][be] Remove unused experimental Rust port
I wrote this a couple summers back as an experiment to see how easily we could translate the compiler to Rust. We make extensive use of in-place mutation of the IR, and the experiment proved that this we can get reasonable ergonomics for this in Rust which was cool. We've since ended up using some of the code here for Relay, allowing Relay Compiler to parse JS files to do more fine-grained extraction of data. For React Compiler though, we plan to continue using JavaScript and explore lightweight native wrappers for things like OXC and SWC plugins. We're also working with the Hermes team to eventually compile the compiler with Static Hermes.

As Tomo always says: always bet on JavaScript.

ghstack-source-id: c5770a2efc
Pull Request resolved: https://github.com/facebook/react/pull/32219
2025-01-24 12:23:31 -08:00

999 B

React Compiler Development Guide

Note: for general notes about contributing, see the CONTRIBUTING.md.

Compiler Development

For general compiler development we recommend the following workflow:

# Install dependencies
yarn

# build the custom test runner
yarn snap:build

# Run the primary tests in watch mode
yarn snap --watch

snap is our custom test runner, which creates "golden" test files that have the expected output for each input fixture, as well as the results of executing a specific input (or sequence of inputs) in both the uncompiled and compiler versions of the input.

When contributing changes, we prefer to:

  • Add one or more fixtures that demonstrate the current compiled output for a particular combination of input and configuration. Send this as a first PR.
  • Then, make changes to the compiler that achieve the desired output for those examples. Commit both the output changes and the corresponding compiler changes in a second PR.