Open tabazevedo opened 2 months ago
I got the same issue using rescript-schema-ppx. Resolution of regular dependencies does seem to be solved by #91 but indeed PPX resolution seems to still be incorrect unfortunately. Don't hesitate to tell us what we can do to help pinpoint or solve the issue.
Great job on all of this btw (+ incremental build), can't wait to switch my monorepo to rewatch!
Thanks for the extensive explanation. It does indeed look like we're not resolving ppx's properly. We started building this with yarn, it symlinks packages in monorepos through the root node_modules. I'll try and have a look this week. But if you would want to tinker with it, you could have a look at how we generate the ppx flags in parse.rs. My hunch is we'd need similar logic as in the other PR.
Ie - we'd need to check if it's either the root or the other path.
@jfrolich - Perhaps we can try and determine from the presence of lock files wether we're dealing with Yarn or Pnpm and drop the overhead of this potential lookup?
Thanks for the detailed explanation.
For the records, I have this issue with my yarn modern (v4) monorepo setup.
Following the recent addition of pnpm support I was looking to move our monorepo to rewatch and noticed a couple of issues which I've reproduced in a thin repo.
Firstly, ppx binary resolution isn't working correctly when ppx dependency is from a child.
In this monorepo example (mind the branch!) we have dependencies set up as follows
@monorepo/root
has no rescript of its own, but is configured with@monorepo/main
as abs-dependency
@monorepo/main
depends on@monorepo/library
@monorepo/library
depends onrescript-logger
and uses"ppx-flags": ["rescript-logger/ppx"]
Actual outcome, running
rewatch build
in root:It's expecting the
rescript-logger
library to be hoisted to the top-level and looking up the binary there:PROJECT_ROOT/node_modules/rescript-logger/ppx
Expected outcome
Binary lookup path is non-hoisted variant:
PROJECT_ROOT/node_modules/@monorepo/main/node_modules/@monorepo/library/node_modules/rescript-logger/ppx
Let me know if I'm missing something, I'll raise a couple of other issues with similar findings in other scenarios.