What you’re looking for is a “Multi Page” application. A lot of the tooling out there focuses on either a single entry file (Single Page App) or Server Side Renderring, but a Multi Page app generates a different JS file for each page (plus some optimizations for shared code)
I haven’t used it myself but vite supports multiple page apps and is really popular right now: Building for Production | Vite
With rescript, you’d usually have two terminals open, one with rescript (npm run dev:res) and then one with vite (npm start)