Yarn-plugin-rescript: Workspace tooling for ReScript projects

yarn-plugin-rescript is a ReScript project tooling made with Yarn Plugin. I just migrated it to work with Yarn 3.

It analyses ReScript dependencies using the Yarn API. And automatically unplugs and links it so the compiler can find the dependency.
This is similar to what pnpm does, but only does what is needed, so the rest of the dependencies can still benefit from Plug’n’Play

It also provides convenience features like yarn res init and yarn res add. You can automate initializing and managing bsconfig.json

Yarn’s plugin system is awesome, there are other possibilities that haven’t been discovered yet.

Any feedbacks are welcome!


Demo are here: https://github.com/reason-seoul/yarn-plugin-rescript/issues/8


That looks amazing! No more dependency added to package.json but not to bsconfig.json!

1 Like

That’s very cool.

Would it be possible and feasible to make the link command a separate package (and maybe even merge it into the build system at a later stage)?

I think it could still rely on the yarn API and package.json but be agnostic from the package manager itself.

I don’t understand what should does standalone link command for

It’s for interop with PnP, and so ​relies heavily on the PnP abstraction layer provided by Yarn. I’m not sure if it’s worth more than just dealing with filesystems in other package managers without Pn

Right, I thought link would (also) iterate over the installed ReScript packages and add them to bsconfig.json if missing, but it is actually just making yarn link compatible with ReScript.

What I am really looking for is a way to automatically add all missing dependencies to bsconfig.json, or a way for libraries to add their deps to bsconfig.json automatically after installation. Not (necessarily) tied to any package manager (but obviously tied to the node_modules-workflow).

Feels like a long term preference would be to not have dependencies in bsconfig.json. Once a linking mechanism exists, the array in bsconfig is just a cache. Could make -with-deps parse package.json, and then cache automatically until the next with-deps call.