Separate compiler and runtime packages?

First, thanks for creating such a great language.

I notice that including the rescript node module as a dependency causes it to build an entire compiler, with native executables, under node_modules/rescript. It also creates runtime dependencies under node_modules/rescript/lib.

That works fine for development.

However, I am using Google Cloud Functions, and I do not want the build server to download and build the entire native rescript compiler (I’m not even sure what it would do). But I do need to tell it about the runtime dependencies.

What I’ve been doing is using webpack so there are no runtime dependencies. This works fine, and I haven’t run into any problems. But I wonder for tidiness sake if it might make sense to separate the compiler, which could be included under "devDependencies", from the runtime library, which could be included under "dependencies"?

1 Like

It sounds like you are lookging for External Stdlib | ReScript Language Manual


That’s a great suggestion! I’ll give that a try.

Yes, that works perfectly, thank you.

I did run into one problem, but I solved it.

My code depends on rescript-promise. The archive for rescript-promise includes a .res file but no .bs.js files. Thus, on the server, there is an error running this line in the generated js:

var $$Promise = require("@ryyppy/rescript-promise/lib/js/src/");

As a solution, I put a node_modules directory under lib and put @ryyppy/rescript-promise/lib/js/src/ there, so it could be found.

@ellbur I guess you should be building your dependencies by running,

rescript build -with-deps

You can add this command in your package.json.