Skip to content
SPECIFICTION
Get listed

js_of_ocaml vs Scala.js

js_of_ocaml

ocsigen.org

Scala.js

scala-js.org

Side by side

Figurejs_of_ocamlScala.js
Price fromFreeFree
Free planYesYes
Free trial——
Open source——
WebYesYes
Windows—Yes
macOS—Yes
LinuxYesYes
APIYesYes
Plans published11
Spec score · Code Transpilers8.4 (#5)7.6 (#19)
JavaScript interoperabilityThe library provides a typed interface for bridging OCaml and JavaScript values, with PPX syntax for JavaScript properties, methods, constructors, and objects.Scala.js can use JavaScript libraries and interact with JavaScript APIs, with either statically or dynamically typed access.
LicenseThe repository lists GPL-2.0-or-later and LGPL-2.1-or-later with the OCaml linking exception as its licenses.The project repository states that Scala.js is distributed under the Apache License Version 2.0.
PerformanceThe project says its benchmarks show generated programs typically run faster than with the OCaml bytecode interpreter.The site describes incremental compilation with 1–2 second turnaround and generated JavaScript starting at 45 kB gzipped for a full application.
Purposejs_of_ocaml compiles OCaml bytecode programs to JavaScript for use in browsers and Node.js.Scala.js is a Scala to JavaScript compiler for building applications that run in browsers, Node.js, and serverless environments.
SupportThe project asks users to report problems or questions through GitHub issues and include version details and a minimal reproducible example when possible.The documentation directs users to the community for help, including Discord and Stack Overflow.

Plans

js_of_ocaml

  • js_of_ocamlFree

js_of_ocaml pricing →

Scala.js

  • Scala.jsFree

Scala.js pricing →

In their own words

js_of_ocaml

js_of_ocaml compiles OCaml bytecode programs into JavaScript for browsers and Node.js. It works with an existing OCaml installation and does not require libraries to be recompiled. Installation is available through opam, while Dune supports separate compilation in development and whole-program compilation in release builds. Whole-program compilation performs global dead-code elimination and cross-module optimization. The library provides a typed bridge between OCaml and JavaScript, including PPX syntax for properties, methods, constructors and objects. Browser bindings cover the DOM, Fetch, WebSockets, WebGL, workers and typed arrays. Optional packages add Lwt support, TyXML, JSON derivation and an OCaml toplevel in the browser. Documented targets include Node.js 18 or later, QuickJS-NG and modern ECMAScript 2020 browsers, including Chrome 80+, Firefox 74+, Safari 13.4+ and Edge 80+. Requirements include OCaml 4.13–5.5, Dune 3.20 or later and Menhir. The project is free and open source.

Visit ocsigen.org

Scala.js

Scala.js is a Scala-to-JavaScript compiler for building applications that run in browsers, Node.js, and serverless environments. The project also states that WebAssembly support is stable. Scala's strong typing can catch mistakes such as mixing strings and numbers or using misspelled method names, while editor support can flag type errors and show inline details about methods, arguments, return types, and documentation. The project describes incremental compilation with a 1–2 second turnaround; generated JavaScript for a full application starts at 45 kB gzipped. Scala.js can use JavaScript libraries and APIs through statically or dynamically typed access. Listed library integrations include React, Angular, Vue, Three.js, and Chart.js. Build tool options include sbt, scala-cli, Mill, and Gradle with a Scala.js plugin. Tutorials list Scala development tools and Node.js as prerequisites and recommend VS Code with Metals. Scala.js is free and distributed under the Apache License 2.0. Documentation points users to community support through Discord and Stack Overflow. The 1.22.0 release is not entirely backward source compatible with 1.21.x.

Visit scala-js.org