feat: disable RNTA temporarily
Summary
- Disables the RNTA temporarily
- Mentions you need to add
package.jsonto your exports in the docs - Automatically adds
package.jsonwith bob if you don't haveincludesGeneratedCode: true. - Closes #637
Why the changes?
Currently, there are two approaches with React Native Codegen.
1. Pregenerate
If you have includesGeneratedCode: true in your codegenConfig, you can generate the Codegen specs in the build time and ship them with your library. This is the recommended way.
2. Let the app generate
If you don't have includesGeneratedCode: true, when the application builds, the React Native Codegen is invoked and goes through all the dependencies of the app and generates the codegen specs. However, if you have ESModule exports and if you haven't added your package.json to the exports property, then the Codegen silently skips your library.
Because Codegen silently fails when you don't have package.json in the exports or don't build Codegen specs at the build time, people might have big problems figuring out this on their own. So we're temporarily disabling RNTA until we enable build time spec generation for it.
Test plan
CRNL
- Generate a library using crnl
- Make sure the RNTA isn't an option there
Bob
- Do
bob initon a library - Make sure
package.jsonis added to the exports field.
Hey @atlj, I'm just trying to understand how RNTA leads to this bug and what we can do to forward fix it instead of disabling it. Afaics, isn't this a bug in core?
Hey @tido64 thanks for jumping in, we don't have any problems with RNTA itself right now. The root problem is that we haven't implemented the precompiled codegen spec shipping feature for RNTA yet, which is currently causing some fragmentations. The plan is to disable the RNTA option temporarily and bring it back with full precompiled codegen spec shipping.
If you're curious about what we need to implement in CRNL for this, you can take a look at #566 where we implemented this feature for vanilla example apps.