This is a simple OCaml ppx rewriter to use node modules in OCaml.
opam install node_of_ocamlIn your dune file:
(executable
(name <exe_name>)
(modes js)
(libraries js_of_ocaml)
(preprocess (pps node_of_ocaml js_of_ocaml-ppx)))If you wish to use a node module, just use this:
let uniq = [%require uniq]To use the compiled file in your browser you cin use your favorite JavScript bundler.