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

yarn2nix and peerDependencies #140088

Open
dhess opened this issue Sep 30, 2021 · 1 comment
Open

yarn2nix and peerDependencies #140088

dhess opened this issue Sep 30, 2021 · 1 comment
Labels
0.kind: bug Something is broken 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md 6.topic: nodejs

Comments

@dhess
Copy link
Contributor

dhess commented Sep 30, 2021

If a Node.js package has peerDependencies in its package.json, yarn2nix doesn't install these dependencies when building the package. These should be installed during the package build process. For example, imagine you're designing a React library that exports some bespoke React components. It's typical in this case to list "react" and "react-dom" as peerDependencies, meaning that they'll be installed for local development and testing (and for things like Storybook.js), but not in the published package, as peerDependencies are supposed to be installed by the downstream consumer of the package.

Therefore, according to my understanding, yarn2nix should be installing peerDependencies prior to the buildPhase, in case the user overrides the default buildPhase, or adds a postBuild step that runs, e.g., yarn --offline build. As it stands, such phases will break due to the missing dependencies.

@dhess
Copy link
Contributor Author

dhess commented Dec 1, 2021

I'm surprised nobody else has jumped on this or indicated that it's a problem for them, as well. Perhaps I'm doing something wrong? How are people who're using yarn2nix dealing with this issue? It's particularly relevant to React projects that use separate component packages, as far as I can tell.

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jun 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.kind: bug Something is broken 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md 6.topic: nodejs
Projects
None yet
Development

No branches or pull requests

2 participants