DEV Community

Discussion on: Thoughts on migrating to TypeScript and improving the overall quality of the frontend DEV codebase

Collapse
 
ben profile image
Ben Halpern

Does ReasonML compile to directly to JavaScript without library overhead in prod?

I'd be open to multiple approaches in different areas if it doesn't add up to more and more bytes needing to be shipped.

Collapse
 
kamilchm profile image
Kamil Chmielewski

It depends how you write it. See reasonml.chat/t/writing-javascript...

Collapse
 
yawaramin profile image
Yawar Amin

ReasonML compiles to pretty minimal strict ES5 that can at times look hand-written. There is very little library overhead and if you know how, you can cut it out almost entirely. See reasonml.chat/t/writing-javascript... for more details. I'm actually working on a very simple ReasonML library right now that will have no library overhead and can be used trivially by JavaScript callers. The transpiler was designed that way, to enable incremental migration.

This is also a good time to try it out–there's been a new ReasonReact release that supports writing zero-overhead React components, with hooks support: reasonml.github.io/reason-react/bl...

On top of all that, ReasonML output minifies really well with Rollup (dead code elimination).