React Compiler with Nx
React 19 comes with an experimental compiler that optimizes application code to automatically memoize code. Read the official React Compiler documentation for more information.
Enabling React Compiler in Nx Projects
For Nx projects using Babel and the @nx/react/babel preset, install the babel-plugin-react-compiler package and enable it with the reactCompiler option.
1{
2 "presets": [
3 [
4 "@nx/react/babel",
5 {
6 "runtime": "automatic",
7 "reactCompiler": true
8 }
9 ]
10 ],
11 "plugins": []
12}
13You can also pass an object to set compiler options.
1{
2 "presets": [
3 [
4 "@nx/react/babel",
5 {
6 "runtime": "automatic",
7 "reactCompiler": {
8 "compilationMode": "annotation"
9 }
10 }
11 ]
12 ],
13 "plugins": []
14}
15Check the React Compiler usage docs for all support setups, such as Vite, Remix, etc.