Scroll to navigation

JS_OF_OCAML(1) Js_of_ocaml Manual JS_OF_OCAML(1)


js_of_ocaml - Js_of_ocaml compiler


js_of_ocaml COMMAND ...


Js_of_ocaml is a compiler from OCaml bytecode to Javascript. It makes it possible to run pure OCaml programs in JavaScript environments like web browsers and Node.js.


File containing the list of unit to export in a toplevel.
--nocmis, --no-cmis
Do not include cmis when compiling toplevel.
Compile a toplevel.


Configure pseudo-filesystem to allow registering files from outside. (default)
Register [FILE] to the pseudo filesystem.
Add [DIR] to the list of include directories.
Configure pseudo-filesystem to NOT allow registering files from outside.
Output the filesystem to [FILE].


Js_of_ocaml pseudo filesystem utility
Build standalone runtime. Used for separate compilation.
Check runtime
Js_of_ocaml compiler
Js_of_ocaml linker
Print standard runtime to stdout


Link JavaScript files [JS_FILES]. One can refer to path relative to Findlib packages with the syntax '+pkg_name/file.js'
Compile the bytecode program [PROGRAM]. Use '-' to read from the standard input instead.


Provide a custom header for the generated JavaScript file, useful for making the script an executable file with #!/usr/bin/env node
enable debug [SECTION].
--debuginfo, --debug-info
Output debug information.
Disable optimization [OPT].
Enable dynlink.
Enable optimization [OPT].
--help[=FMT] (default=auto)
Show this help in format FMT. The value FMT must be one of `auto', `pager', `groff' or `plain'. With `auto', the format is `pager` or `plain' whenever the TERM env var is `dumb' or undefined.
Keep unit name
Link all primitives.
--no-sourcemap, --no-source-map
Don't generate source map. All other source map related flags will be be ignored.
--noinline, --no-inline
Disable inlining.
--noruntime, --no-runtime
Do not include the standard runtime.
Set output file name to [FILE].
Set optimization profile : [NUM].
Pretty print the output.
-q, --quiet
suppress non-error messages.
[DEPRECATED: use js_of_ocaml build-runtime instead]. Generate a JavaScript file containing/exporting the runtime only.
Set compiler options.
Set environment variable statically.
Inline sourcemap in the generated JavaScript.
Do not inline sources in source map.
root dir for source map.
--sourcemap, --source-map
Generate source map.
--target-env={isomorphic,browser,nodejs} (absent=isomorphic)
Runtime compile target.
Show version information.
turn all warnings into errors.
--wrap-with-fun=VAL (absent=<Immediately Invoked Function Expression>)
Wrap the generated JavaScript code inside a function that needs to be applied with the global object.


Bugs are tracked on github at




Jerome Vouillon, Hugo Heuzard.


Copyright (C) 2010-2020.

js_of_ocaml is free software, you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, with linking exception; either version 2.1 of the License, or (at your option) any later version.

Js_of_ocaml 4.0.0