Quantcast
Channel: ReScript Forum - Latest posts
Viewing all articles
Browse latest Browse all 1829

[Help] Fast Refresh with Vite and ReScript React ecosystem

$
0
0

We have been having trouble with spurious reloads. We use a patch for vite-rescript.

Here are my observations:
Vite (rollup?) seems to be really smart with finding module dependencies, if a javascript module A uses module B’s function B.doThing then a dependency edge AB is made. If B is changed (and invalidated in vite terms), then A will also be invalidated. Anything that depends on A will not be necessarily be invalidated this the change propagation will end.

Say you change the rescript file for B, and then let rescript complie your project by compiling B and then compiling A, because A depends on B’s doThing, then both B and A seems to be written to disk regardless of if content changes (I watched inotify). Typically this means that any file change will cause the root file to be recompiled through a path from the changed file to the root and finally trigger a HMR reload.

We get around this by skipping changes via a content-hash.

Any feedback is very welcome.


Viewing all articles
Browse latest Browse all 1829

Trending Articles