zth/rescript-relay-router

Generated route module won't update if the project can't compile

Kingdutch opened this issue · 2 comments

I've noticed that the Routes..Route module won't update in case there are other errors in the Rescript project. This is quite problematic in case the error in the project is a type mismatched caused by code in that module (e.g. the query parameters were incorrectly typed). To fix this the user must first remove the usage of the query parameter to make the project compile and then rebuild the project.

Ah could it be that the routes are only generated by Vite? So since I try to build Rescript before I run Vite that's why my routes aren't being regenerated?

Ah I think this was a PEBCAK

I never added the router CLI as a concrete part of my build (or as watcher) in package.json. Mostly because it was occassionally handled by VSCode I think.

Adding rescript-relay-router generate to my build and rescript-relay-router generate -w to my dev watcher fixes the issue :D