zth / rescript-relay-router

MIT License
16 stars 3 forks source link

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

Closed Kingdutch closed 2 years ago

Kingdutch commented 2 years ago

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.

Kingdutch commented 2 years ago

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?

Kingdutch commented 2 years ago

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