Vercel or similar for rescript sites using ocaml libraries?

Has anybody already used Vercel or anything similar to deploy a front end which compiles and uses some ocaml libraries? That is, has anybody configured Vercel to install dune or opam as part of its install step?

I hit an obstacle trying to install esy on Vercel. I didn’t spend a lot of time troubleshooting it.

I think you will hit a very hard limit with installing esy / opam on Vercel, since it would probably try to compile the whole compiler toolchain, which will take like 10 minutes per build. Not sure if this is desirable since Vercel’s plan includes a certain amount of build minutes and also has max build times afaik.

1 Like

Is it possible for you to cache the build artifacts in a ReScript compatible format and download it instead? that way you’d only need the bs-platform dependency, if I am not mistaken.

Might be worth asking the native dev folks in the Reason forum / Discord as well.

Good idea generally. In this use case, we would want people to be able to modify the ocaml libraries and scripts as part of a PR and see the result of their work, so creating a custom base image or creating an debian repo that amazon-linux can install from might be the only way to get fast build times.

We got pretty close to getting this to run under four minutes by copying our esy files into well known Vercel caching locations. Occasionally, we ran into small errors when modifying the version of esy. I think those errors could be worked out.

I haven’t tested out installing esy inside of netlify yet.