This PR adds a check in `@nx/react/babel` preset to enable React
Compiler when `babel-plugin-react-compiler` is installed.
This affects:
- React apps using Webpack + Babel
- React libs using Rollup + Babel
- React Native apps using Webpack + Babel
If SWC is used, there is no way to use React Compiler currently.
Also adds a [new
recipe](https://nx-dev-git-feat-react-compiler-nrwl.vercel.app/recipes/react/react-compiler)
showing how to enable the compiler using `@nx/react/babel`.
## Current Behavior
<!-- This is the behavior we have today -->
## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->
## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->
Fixes #
Improved the '@nrwl/react/babel' preset to allow for customisation of all options provided by
the
'@nrwl/web/babel' preset.
ISSUES CLOSED: #10939
Co-authored-by: Jason Gerbes <jason.gerbes@vista.co>
* fix(react): is next js check caller is sometimes undefined
* fix(react): refactor to optional chaining
Co-authored-by: Mark Goho <markgoho@gmail.com>
Co-authored-by: Mark Goho <markgoho@gmail.com>
* fix(nextjs): update babel setup to better support next apps
* fix(testing): remove babel-jest.config.json used in jest.config.js
- Fix `@nrwl/web/babel` to support Jest as well