js_of_ocaml
js_of_ocaml copied to clipboard
[BUG] js_of_ocaml error, cannot parse javascript file
Using js_of_ocaml 3.5.2, my dune builds are failing when I attempt to include this file: https://cdnjs.cloudflare.com/ajax/libs/tensorflow/1.5.2/tf.js .
I narrowed down the problem to this:
$ js_of_ocaml --runtime-only tf.js
js_of_ocaml: Error: cannot parse file "tf.js" (orig:"tf.js" from l:22, c:417638)
Our javascript parser doesn't understand the getter syntax in objects
{get prop() { ... } }
{get [expression]() { ... } }
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/get
A workaround is to not pass that file to jsoo and bundle it later.