Proposal: Make build -with-deps a default behaviour

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.

8 Likes

I also have -with-deps flag on all my build scripts

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.

1 Like

I’m all for making it the default.

2 Likes

Yes let’s help people fall into the pit of success.

4 Likes

any benefit in introducing --without-deps with the change?

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?

We could wait until someone comes to this forum and says “hey my builds are taking too long” and then add it.

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.

1 Like

I don’t see a need for this.

I’ve made the PR to compiler Make build -with-deps a default behaviour by DZakh · Pull Request #6350 · rescript-lang/rescript-compiler · GitHub

4 Likes

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).

1 Like

Which rescript version do you use?

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 :thinking:

1 Like