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

Pinned and Dev dependencies interacting #6679

Open
CarlOlson opened this issue Mar 15, 2024 · 1 comment
Open

Pinned and Dev dependencies interacting #6679

CarlOlson opened this issue Mar 15, 2024 · 1 comment

Comments

@CarlOlson
Copy link

CarlOlson commented Mar 15, 2024

This is hard to explain, so here is a reproducible example. The names of workspaces and modules were chosen to somewhat reflect the project I discovered this in. This was confirmed on version 10.1.2 and 11.0.1.

If you have 3 workspaces W_root, W_a, and W_b. W_root adds the two others as pinned dependencies. W_a and W_b both contain a dev directory with some module M. If W_a includes W_b as a dev dependency, then opens W_b, then W_b.M will collide with W_a.M when used.

Snippet from the example repo's output:

FAILED: test/MainTest-SrcHelpers.cmj

  We've found a bug for you!
  <removed>/rescript-shadow-test/src-helpers/test/MainTest.res:4:14-23

  2 │
  3 │ let _ = Helper.setup()
  4 │ let config = Config.get()
  5 │

  The module or file Config can't be found.
  - If it's a third-party dependency:
    - Did you add it to the "bs-dependencies" or "bs-dev-dependencies" in bsconfig.json?
  - Did you include the file's directory to the "sources" in bsconfig.json?


  Hint: Did you mean Config or Config?

What do I expect?

  • I expect the modules in a "type": "dev" directory to never collide when building a different project.
  • I expect the error message to be more helpful. Perhaps the hint should use the full module path: Hint: Did you mean SrcHelpers.Config or TestHelpers.Config? (this wouldn't fix the problem, but would have made discovering the cause easier)
@zth
Copy link
Collaborator

zth commented Mar 15, 2024

@CarlOlson thanks for the detailed report and reproduction! 🙏

There's some ongoing work related to this "behind the scenes" currently. Hopefully this and more things related to pinned dependencies will clear up a lot in the not too distant future.

Maybe one of our monorepo users has some insight already. Cc @tsnobip @fhammerschmidt

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

2 participants