Skip to content
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 config issue #713

Closed
1 of 2 tasks
riteshshukla04 opened this issue Dec 3, 2024 · 2 comments
Closed
1 of 2 tasks

Codegen config issue #713

riteshshukla04 opened this issue Dec 3, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@riteshshukla04
Copy link
Contributor

Description

I am facing issue while using codegen . The build starts failing

  1. When I remove outputDir from codegen config android build starts breaking. (which I think is optional)
  2. If I turn the includesGeneratedCode to false cmake is no longer able to link the specs generated 'react_codegen_RNCodegenExampleSpec'

If I keep the outputDir and includesGeneratedCode I am getting the below error on iOS
Image

Packages

  • create-react-native-library
  • react-native-builder-bob

Selected options

✔ What type of library do you want to develop? › Turbo module
✔ Which languages do you want to use? › C++ for Android & iOS

Link to repro

https://github.com/riteshshukla04/rn-codegen-repro

Environment

System:
OS: macOS 15.1
CPU: (8) arm64 Apple M2
Memory: 194.16 MB / 16.00 GB
Shell:
version: "5.9"
path: /bin/zsh
Binaries:
Node:
version: 22.7.0
path: ~/.nvm/versions/node/v22.7.0/bin/node
Yarn:
version: 3.6.1
path: ~/.nvm/versions/node/v22.7.0/bin/yarn
npm:
version: 10.8.2
path: ~/.nvm/versions/node/v22.7.0/bin/npm
Watchman: Not Found
Managers:
CocoaPods:
version: 1.15.2
path: /Users/riteshshukla2/.rvm/gems/ruby-2.7.5/bin/pod
SDKs:
iOS SDK:
Platforms:
- DriverKit 24.1
- iOS 18.1
- macOS 15.1
- tvOS 18.1
- visionOS 2.1
- watchOS 11.1
Android SDK: Not Found
IDEs:
Android Studio: 2024.1 AI-241.18034.62.2412.12266719
Xcode:
version: 16.1/16B40
path: /usr/bin/xcodebuild
Languages:
Java:
version: 17.0.12
path: /usr/bin/javac
Ruby:
version: 2.7.5
path: /Users/riteshshukla2/.rvm/rubies/ruby-2.7.5/bin/ruby
npmPackages:
"@react-native-community/cli": Not Found
react: Not Found
react-native: Not Found
react-native-macos: Not Found
npmGlobalPackages:
"react-native": Not Found
Android:
hermesEnabled: true
newArchEnabled: true
iOS:
hermesEnabled: true
newArchEnabled: true

@riteshshukla04 riteshshukla04 added the bug Something isn't working label Dec 3, 2024
@riteshshukla04
Copy link
Contributor Author

riteshshukla04 commented Dec 4, 2024

Upon looking into deeper RCA . The culprit seems to be below line.

let codegenAndroidPath: string | undefined =
packageJson.codegenConfig.outputDir.android;

If we remove outputDir from package.json . packageJson.codegenConfig.outputDir becomes undefined and throws an error when trying to access the android key. Adding optional chaining would fix the issue .

It wont make a difference as error will be thrown the next line but atleast the error message will be debuggable

@riteshshukla04
Copy link
Contributor Author

#716 . Please see if this can be merged

satya164 pushed a commit that referenced this issue Dec 10, 2024
This will prevent undefined from being thrown as error and actual error
will be thrown.

#713

Co-authored-by: Ritesh Shukla2 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant