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

Workspaces + Peer Dependency resolution bug #7429

Open
rt2zz opened this issue Jul 23, 2019 · 0 comments
Open

Workspaces + Peer Dependency resolution bug #7429

rt2zz opened this issue Jul 23, 2019 · 0 comments

Comments

@rt2zz
Copy link

rt2zz commented Jul 23, 2019

Do you want to request a feature or report a bug?

What is the current behavior?
In a yarn workspaces monorepo, trying to install handlebars and handlebars-loader with nohoist.

  • handlebars is installed at packageA/node_modules/handlebars (v4) and packageB/node_modules/handlebars (v1) as expected
  • handlebars-loader is installed at packageA/node_modules/handlebars-loader as expected
  • handlebars-loader has its own copy of handlebars (v1, wrong version) at packageA/handlebars-loader/node_modules/handlebars.

Because handlebars-loader has a peer dependency with a very wide range of acceptable versions, it seems to always pick the lower version which is specified in packageB. I tried a variety of things, including setting custom resolution and different nohoist configurations but nothing resolved the issue. Finally my workaround was to fork and remove the peer dependency.

If the current behavior is a bug, please provide the steps to reproduce.

  • yarn workspaces repo with packageA and packageB
  • packageA depends on handlebars@1
  • packageB depends on handlebars@4 and handlebars-loader
  • yarn install
  • oberserve handlebars loader load handlebars@1 from packageA/node_modules/handlebars-loader/node_modules/handlebars

What is the expected behavior?
either

  • peer dependencies should not auto install
    or
  • peer dependencies should only install if an existing dep does not satisfy the requirement

Please mention your node.js, yarn and operating system version.
nodejs v12.6.0
yarn v1.17.3
osx v10.14.5

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

No branches or pull requests

1 participant