Is it possible to write bindings for Preact to work with Rescript? Since the React bindings are a library and not built into the language it seems like this would be doable.
I’m new to Rescript, so let me anyone would like more details about my question.
I would definitely love to have support for preact to reduce my bundle size and improving performance. In the vast majority of cases I can use it as a drop in replacement, and even when using react itself preact signals are almost always a better abstraction than react hooks and contexts.
Okay, what do you do to make it alias in Rescripts build system? Is there some config file where you tell it to grab Preact instead of react ? I’m looking at the interop between rescript and javascript build systems right now.
Yes, I am familiar with that, thank you. I am asking about the rescript side of things. Assume Vite/Webpack if it makes the question specific enough.
Does setting up aliases in webpack make rescript just automatically import the aliased library? Does rescript integrate easily with webpack? Or is that the wrong question to ask because rescript happens to cover something without involving the build system? Etc etc
The point of setting up aliases is that it should ‘just work’ without any other effort. So it may be worth your while to just try it out and report your findings.
I haven’t tried it with webpack, but I have used rescript + preact with vite as the build system using the aliases as described in the preact docs. It was just a toy project, not production, but it seemed to work fine.