How to do code splitting with Reason (ReasonReact)?


#1

I am trying use reasonml (ReasonReact specificallyl) for my toy project (a web application) and the experience so far is really great.
However, to be able to use it in production, I need a way to optimize the bundle build size. With normal react, we are using react-loadable and dynamic import and let webpack handle the splitting.
So what is the proper way to do code splitting with ReasonReact?


#2

Well, the code is naturally split. Each file creates it’s own *.js for you. Submodules work the same way as well. I’ve used webpack for bundling, but more recently have moved over to Parcel.


#3

I think he means the usage of the dynamic import statement in js where you can asynchronously load files.
I think there is no official way, yet. I am too very interested in this


#4

There’s an open issue: https://github.com/BuckleScript/bucklescript/issues/2765