-
Notifications
You must be signed in to change notification settings - Fork 34
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
Fix duplicate dependencies during gradle build. #269
Conversation
Someone is attempting to deploy this pull request to the software-mansion Team on Vercel. To accomplish this, the commit author's email address needs to be associated with a GitHub account. Learn more about how to change the commit author information. |
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 seems to have fixed this issue I was experiencing on RN 74 dev client builds
const workspacePath = getAppRootFolder(); | ||
const packageJsonPath = path.join(workspacePath, "package.json"); | ||
|
||
try { | ||
const jsonString = await fs.promises.readFile(packageJsonPath, "utf8"); | ||
const packageJson = JSON.parse(jsonString); | ||
return semver.valid(semver.coerce(packageJson!.dependencies["react-native"])) ?? "0.74.0"; | ||
} catch (err) { | ||
Logger.debug("Error:", err); | ||
} | ||
|
||
return "0.74.0"; |
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 think we should use the technique where we check installed react-native and not what's in the package.json. It could be that lower version is specified with ^ and 0.74 could be installed in that case.
We should use this technique: https://github.com/software-mansion/react-native-ide/blob/main/packages/vscode-extension/src/project/metro.ts#L102 to locate react-native in node modules, then extract version field from package.json under that folder. This should give us an explicit version number instead of some pattern. Also, you can use require to load JSON files instead of using fs
Description:
some 3rd party libraries, could cause duplication of classes during transformation we performed in configureReactNativeOverrides.
This is a solution for RN versions 74 and higher that relays on the fact that we don't need to perform configureReactNativeOverrides for those versions, because the solution were marged upstream.
see: facebook/react-native#42617
How to reproduce a bug?
npx react-native init your-project
npm i react-native-biometrics
note that react-native-ide will believe that it is not a native change so it you will have to manually clean rebuild every time you add or remove react-native-biometrics.
This is the reported error in build logs: