Expo Hot Reloading for Rescript

So, I spent all day figuring this out, and so I figured I’d share my findings so no one else has to go through this.

I was having trouble getting Expo to pick up on changes to my Rescript files. It got very cumbersome and frustrating.

Anyway, what I eventually deduced was the issue, is that Babel would see the changes to m .res files, trigger a re-render, which is fine I guess. The problem is that the Rescript compiler is so fast that it wouldn’t see the update to the .bs.js file. So, I just told Babel to ignore .res files and now things are working as expected.

This is my babel.config.js

module.exports = function (api) {
  api.cache(true);
  return {
    presets: ["babel-preset-expo"],
    plugins: ["react-native-reanimated/plugin"],
    exclude: ["*.res"],
  };
};
2 Likes