Getting ReScript to require my modules

I have some modules that run some plugin registration stuff when they are required, imagine something like


CommandModule.addCommand(“foo”, fooCmd)

concise question: how can I tell ReScript that it needs to require the module just so it is loaded (but I dont want to reference anything inside it)

alternatively: is this bad design and what should I do instead? I would prefer having to avoid listing all of the commands in the main module (for my particular project ,its not actually commands, and I might end up with hundreds of registrations)

I would stuff them inside of a function and run that function where you want the module to be imported. It costs you an extra function call but gives you more readability/clarity imo.

I’m thinking I should create a build step that finds all plugins and generates a file that registers them. does that sound feasible?

what options do i have for this? is this the ppx route? or does rescript support something for it?