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

Autolinking transitive native dependencies. (Component Library Monorepo) #923

Closed
cboar opened this issue Jan 25, 2020 · 5 comments
Closed
Labels
question Further information is requested

Comments

@cboar
Copy link

cboar commented Jan 25, 2020

We are running into issues with the autolinker not picking up on transitive dependencies that need linking. The following is a sample structure for our project.

▾  component-library/
  ▾  Component1/               
    ▸  src/                  
       package.json            
  ▾  Component2/               
    ▸  src/                  
       package.json

▾  implementation-app/         
  ▸  android/                  
  ▸  ios/                      
     App.js                    
     app.json                  
     babel.config.js           
     index.js                  
     metro.config.js           
     package.json              

Individual components from the component library are included in the implementation App's package.json as such:

  "dependencies": {
    "@my-comps/component1": "file:../component-library/Component1"
  }

Some of our components depend on a native module that requires linking from the implementation App, such as react-native-device-info.

When building the implementation App, it is evident that these transitive dependencies are not linked, as the generated PackageList.java does not include them - only those directly defined in the App's package.json. I've looked at configuring react-native.config.js for each component, but was unable to find configuration that could assist with this kind of set up.

@cboar cboar added the question Further information is requested label Jan 25, 2020
@liamjones
Copy link
Contributor

We've hit this too - what we've been doing, for now, is adding the module as a peer and dev dependency in the component project and that at least then flags if it's not been added as a direct dependency in the top-level app.

@vomchik
Copy link

vomchik commented Jan 31, 2020

The same issue :(

@cboar
Copy link
Author

cboar commented Jan 31, 2020

@liamjones Adding them as devDependencies/peerDependencies at the component-package level does not seem to help.

I have also tried manually linking these native modules, but it seems you are no longer able to link a package that is not directly defined in package.json - so the same issue remains:

error Unknown dependency. Make sure that the package you are trying to link is already installed in your "node_modules" and present in your "package.json" dependencies.

@thymikee @grabbou @Esemesek Any insight on this? I don't think this is an obscure use-case.

@liamjones
Copy link
Contributor

@cboar ah, you misunderstand. It doesn't fix the issue, no, but does result in yarn complaining about an unmet peer dependency which hopefully prompts the dev to add it as a direct dependency. :)

@thymikee
Copy link
Member

thymikee commented Mar 9, 2020

Same problem as #870. Let's move the discussion there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants