Otherwise, create a root-level rescript.json and list your three projects as dependencies. Ensure that the name fields in each package.json match the corresponding names in rescript.json.
Run rescript --verbose to output the detected project contexts. When configured correctly, running this command from the repository root will display the monorepo structure.
After I added all monorepo packages as deps and set sources as an empty array, it resolved the deps. But I bumped into the issue with @rescript/react: it still uses old pipe (|>) syntax which is dropped in v12?
The module or file Pervasives can't be found.
- If it's a third-party dependency:
- Did you add it to the "dependencies" or "dev-dependencies" in rescript.json?
- Did you include the file's directory to the "sources" in rescript.json?
Wonderful, that would indicate that @rescript/runtime is not found.
Could you describe in which folder it is installed?
Are you running rescript build from your repo root?
Actually, I didn’t have @rescript/runtime installed. After I installed it and added to the dependencies section of lib package, the Pervasives is gone, but I’m getting this:
[1/7] 📦 Building package tree...ERROR:
We could not build package tree '@rescript/runtime', at path '/Users/Alex/Dev/psc'. Error: No such file or directory (os error 2)
FWIW @rescript/runtime doesn’t have rescript.json, only package.json.
I run rescript build from the package directory.
If I run rescript build from the root, it succeeds, but doesn’t build anything because the sources is empty.
From the root, it should have build your dependencies. It is normal that your root rescript.json doesn’t have any sources. It makes sense to me that building from the package level won’t work, that is something we still need to fix.
Can you try one last rescript clean and rescript build from the root.
I would expect that at least to work.
But when I try to build the package from the package directory:
❯ npm exec -- rescript build
[1/7] 📦 Building package tree...ERROR:
We could not build package tree '@rescript/runtime', at path '/Users/Alex/Dev/psc'. Error: No such file or directory (os error 2)
So basically, listing dependencies in the root rescript.json helps with resolving monorepo packages when running rescript build for a specific package, but it doesn’t build the packages when running rescript build from the root.
I figured that when I run npm exec -- rescript build from the root, it uses v11 for whatever reason. I’m going to clean this mess up so the repo only has v12 and report back on what’s going on when I run it from the root with v12.