Giter Club home page Giter Club logo

Comments (5)

arcanis avatar arcanis commented on August 22, 2024

A workspace has no parent from its general perspective, so it doesn't provide any peer dependency (until it gets used as a dependency of another package). You need to also list expo/react-native as devDependencies (I guess expo already is?).

from berry.

quentez avatar quentez commented on August 22, 2024

@arcanis Thank you for taking a look at this!

I'm not sure I fully understand your answer though.

I'm not doing anything at the workspace level, it's only within one of the sub-packages. Shouldn't it be enough to specify expo as peerDependency without having to also add it as dependency/devDependency?

(I'm not calling expo directly, I'm only adding it to satisfy the constraint from the expo-secure-store dependency).

from berry.

arcanis avatar arcanis commented on August 22, 2024

Workspaces have two perspectives (sets of dependencies):

  • As dependencies of another workspace
  • As root of the dependency tree (for example when running yarn run from within this workspace's folder)

Even if workspaces depending on @baqhub/sdk-expo declare react-native in their dependencies, the second perspective is still there: if you run a yarn run command from packages/lib-sdk-expo, there will be no "parent package", thus no react-native. That's why listing a peer dependency often means you need a matching dev dependency (we probably should make this clearer).

from berry.

quentez avatar quentez commented on August 22, 2024

That makes sense! I appreciate the thorough explanation 🙇‍♂️
And the solution is quite straightforward as well. Not a bug then!

from berry.

TheAsda avatar TheAsda commented on August 22, 2024

Faced the same issue and could not figure it out for a long time. IMHO yarn run is not the most common usage of a package. Clearer error message or some references in documentation would be so much help. With "add to peers" approach it's easy to make sure you have only one copy of a package in your project. Duplicating dev dependencies can lead to multiple versions of a package is workspaces environment if not careful with dependencies management.

from berry.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.