OCaml: 4.13 to 5.5
Build tools:
Libraries:
The generated JavaScript works with:
Note: Stdlib.Weak and Stdlib.Ephemeron require WeakRef support (ECMAScript 2021), available in all modern browsers and Node.js 14.6+.
For most users, install the compiler and ppx:
opam install js_of_ocaml js_of_ocaml-compiler js_of_ocaml-ppx
For asynchronous programming with Lwt:
opam install js_of_ocaml js_of_ocaml-compiler js_of_ocaml-ppx js_of_ocaml-lwt
To install all available packages:
opam install js_of_ocaml js_of_ocaml-compiler js_of_ocaml-ppx \ js_of_ocaml-lwt js_of_ocaml-tyxml js_of_ocaml-toplevel \ js_of_ocaml-ppx_deriving_json
To compile to WebAssembly instead of JavaScript:
opam install wasm_of_ocaml-compiler
Additional requirement: Binaryen 119 or later must be installed on your system. See Binaryen installation.
See wasm_of_ocaml for usage.