Size of generated javascript in incr_dom examples


I have been playing around with the examples in the incr_dom library today. It’s great fun and I’m impressed by the library.

That said, I’m a bit put off by the size of the generated javascript. I’ve been looking mostly at the ‘ts_gui’ example, where the generated javascript is about 1.1 mb with the release profile enabled in dune. I’ve also run the generated file through webpack to see if it could strip anything else out of it (it couldn’t).

Even the hello_world example is just over 900 kb with the release profile. This seems quite large to me and I’m wondering if there’s anything obvious that I’m doing wrong.

Thanks for any help!


Hi, I’m not a JSOO user myself, but based on search history in this forum, library dependencies and PPXs tend to add to output size. So e.g. if you have ppx_deriving_* stuff or Core_kernel dependencies, you might try removing those.

Thanks for the response - I did see another post suggesting that. The examples aren’t using any ppx libraries at runtime, however they are using Core_kernel quite extensively. The incr_dom library itself seems to use Core_kernel a fair bit though, as does incremental that it depends on.

Including Core_kernel (and more) is therefore unavoidable if you want to use the incr_dom library. It doesn’t matter too much, just wondering if there is another trick or build option I could try.