Dependency issue with pinned-dependencies
How to reproduce:
$ git clone --branch pinned-dependency-issue https://github.com/Minnozz/rescript-reproduce-issue.git
$ cd rescript-reproduce-issue
$ yarn
$ cd main-project && yarn rescript build -w
In other terminal:
$ cd dependency-project && yarn rescript build -w
Both projects compile successfully.
In other terminal:
$ touch main-project/src/MainProject.res
main-project recompiles successfully.
$ touch dependency-project/src/DependencyProject.res
dependency-project recompilation fails:
>>>> Start compiling
rescript: [3/3] src/DependencyProject.cmj
FAILED: src/DependencyProject.cmj
We've found a bug for you!
/home/bart.schuurmans/src/github.com/Minnozz/rescript-reproduce-issue/dependency-project/src/DependencyProject.res:1:16-25
1 │ let fn = () => React.null
2 │
The module or file React can't be found.
- If it's a third-party dependency:
- Did you list it in bsconfig.json?
- Did you run `rescript build` instead of `rescript build -with-deps`
(latter builds third-parties)?
- Did you include the file's directory in bsconfig.json?
FAILED: cannot make progress due to previous errors.
>>>> Finish compiling(exit: 1)
If I run rescript build -w -with-deps, this fixes the compilation the first time, but it can happen again later.
For some reason the test case does not always reproduce this issue; I can't figure out what exactly triggers it.
$ cd dependency-project && yarn rescript build -w
It is required to run the build in the toplevel project, this applies to pinned-dependencies too
This section of the docs states:
Important: ReScript will not rebuild any pinned-dependencies in watch mode! This is due to the complexity of file watching, so you'd need to set up your own file-watcher process that runs rescript build on specific file changes.
Shall I add a note that running a second rescript build -w for the pinned dependency is not allowed?
Is there a different long-term solution for this that we want?
I use a custom external watch script which I originally wrote because I wanted a native watcher (the rescript one is implemented in JS). But it's useful for pinned packages too.
I meant to post it at the time but I forgot 🤦♂️
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.