A problem with rescript build is that it doesn’t rebuild a package when a new version is installed. It’s especially critical when multiple developers are working on a project. Often they don’t know when some package is updated to run rescript build -with-deps.
To solve the problem, we have -with-deps in all our scripts, including the ones with watch mode. I think it makes sense to make it a default behavior and add something like -without-deps as @tsnobip suggested in the [ANN] ReScript 9.1.4 release - #3 by tsnobip.
I think it’ll be a more reliable default, even if the issue with rebuilding packages when the version change is fixed.
During the last two months, I got two issues on GitHub and a question in telegram about my library not working. The reason was that they were changing the suffix option in bs-config and running rescript build.
I think it’s not normal that three random people got a very difficult-to-debug error which can be easily prevented by having the -with-deps flag turned on by default.
What does --with-deps do? I have a pnpm monorepo with custom Jest bindings in it’s own package, and anytime I modify the Jest package I have to run npx rescript clean to pick up the changes, is that related?
With -with-deps you don’t need to run rescript build, just restart the compiler.
It doesn’t build the dependencies in watch mode.
Especially useful when working in a team and pulling changes with a ReScript package updated. With -with-deps it’ll just work. While without it you’ll first get a weird compile/runtime error, and then need to run rescript clean to fix it.
I don’t think the performance makes any difference on modern machines, it’s 30-40ms on my apple silicon mac, but it would be nice if -with-deps didn’t print the full list of dependencies every time (although printing things it needs to build would be ok).
That is with version 10. My big production project doesn’t support 11 at the moment (it’s been mothballed for 2 years).
I don’t have a ton of dependencies at the moment, but it’s a monorepo and I would eventually like to make each sub-project a dependency. I suppose if I switch to rewatch I won’t be using rescript to build directly