-
Notifications
You must be signed in to change notification settings - Fork 24.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Codegen not respecting ignored linked dependencies in react-native.config.js #47550
Comments
Thanks for reporting the issue, @mrbrentkelly. I'll try to work on this asap. 0.76.2 is planned for tomorrow, so it's unlikely that the fix would be out. I'll make my best to have it out for 0.76.3. Meanwhile, you should be able to unblock yourself by manually removing the lines from Xcode. |
Hi @mrbrentkelly, I was thinking about this issue more deeply, and I am not sure whether disabling Codegen if the library is excluded from autolinking is the right thing. Let me try to explain:
A couple of clarification questions:
|
Uninstalling isn't always an option... Say for example an app wants to use a particular RN library on Android and not iOS (or vice versa)... typically the approach would then be to disable the library for the intended platform in the Another example would be you're using a RN library like Sentry where linking the native side is optional depending on which APIs you want to use. Or perhaps you're in a monorepo of multiple apps and node_modules contains all dependencies for all apps. Another example would be an RN library that you link for debug builds but not release builds (perhaps via an environment var in utilised in the react-native.config.js).
It sounds like the codegen for iOS should be looking at linked pods (after RN auto-linking), instead of relying on what's contained in node_modules. That would then work for manually linked libs and auto-linked ones... node_modules aren't the single source of truth for a React Native app, and as I've noted above there's multiple variables to consider. So I think we are going to need better control over when the codegen happens? |
Yes, I believe that codegen and autolinking should be decoupled. For completeness' sake, autolinking works by asking for some configuration to get a list of libraries that needs to be linked. For projects with the CLI, thats Codegen, instead, looks at both libraries in your Also, starting from 0.77 we will not generate the Given that autolinking is using that file to decide what to link in the app, we can patch 0.76 to remove the library from the list of libraries if the |
Description
When a third party react-native dependency exists in an app's package.json but has been disabled from auto-linking in the
react-native.config.js
file, react-native-codegen still generates native Objective-C code for the unlinked dependency, leading to build failures.Steps to reproduce
Create a new RN project and add a third party library that contains native code (e.g.
react-native-screens
)Create a
react-native.config.js
file and disablereact-native-screens
from auto-linking on iOS...Run pod install and try and build/run the iOS app
Build will fail because the generated
RCTThirdPartyFabricComponentsProvider
files reference things that are linked in the project (e.g._RNSScreenCls
).React Native Version
0.76.1
Affected Platforms
Runtime - iOS
Areas
Codegen
Output of
npx react-native info
Reproducer
https://github.com/mrbrentkelly/rn-codegen-linking-bug
Screenshots and Videos
No response
The text was updated successfully, but these errors were encountered: