-
Notifications
You must be signed in to change notification settings - Fork 13
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
feat: using forked segment library in cio-rn package #219
Conversation
tsconfig.json
Outdated
"@segment/analytics-react-native": ["../@segment/analytics-react-native/src/index"], | ||
"@segment/sovran-react-native": ["../@segment/sovran-react-native/src/index"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are these needed in the tsconfig file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This tell the import libraries the path to import libraries from.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do understand that is what the paths
config option in tsconfig
is doing.
I do not understand the reason why we need to modify the tsconfig
file.
The 2 segment modules are npm dependencies declared in package.json
. Therefore, I would expect that our code should be able to import these dependencies via npm without the need to modify tsconfig
file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe its probably because of the fact that they are using a separate yarn workflow
that sets their tsconfig.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently, the libraries are being installed from GitHub instead of npm. As a result, the tsconfig
file does not find the necessary paths defined, hence throwing the errr Cannot find module '@segment/analytics-react-native' or its corresponding type declarations
. Adding the path mappings to the tsconfig
file resolves this issue and allow the imports to be correctly resolved. I hope this helps.
tsconfig.json
Outdated
"@segment/analytics-react-native": ["../@segment/analytics-react-native/src/index"], | ||
"@segment/sovran-react-native": ["../@segment/sovran-react-native/src/index"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe its probably because of the fact that they are using a separate yarn workflow
that sets their tsconfig.
@mrehan27 @Shahroz16 @levibostian Since this PR is approved but CI tests are failing due to some yarn issues. I tried clearing yarn cache and updating checksums along with other attempts but nothing helped. Does anyone have an idea why the PR isn't passing the tests? |
@ami-aman Not sure. But probably because we mostly use |
I think I got it fixed in the commit I just pushed. I fixed it by modifying the By theory is that by using a git commit hash, the lock file (should) stay up-to-date no matter what the future holds for branch |
Refers [CDP] RN iOS: Fork & Integrate Segment React Native SDK #11653
NOTE
This pull request gets merged into
main_cdp_rn
and notmain
to avoid releases before CDP work is complete and well tested. If anyone in the squad feels not aligned with this reason then please feel free to suggest a change.