Skip to content

[BUG] js_of_ocaml error, cannot parse javascript file (getter syntax) #972

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Ngoguey42 opened this issue Feb 29, 2020 · 1 comment · Fixed by #1391
Closed

[BUG] js_of_ocaml error, cannot parse javascript file (getter syntax) #972

Ngoguey42 opened this issue Feb 29, 2020 · 1 comment · Fixed by #1391

Comments

@Ngoguey42
Copy link
Contributor

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)
@Ngoguey42 Ngoguey42 added the bug label Feb 29, 2020
@hhugo
Copy link
Member

hhugo commented Mar 18, 2020

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.

@hhugo hhugo mentioned this issue Jan 11, 2022
@hhugo hhugo changed the title [BUG] js_of_ocaml error, cannot parse javascript file [BUG] js_of_ocaml error, cannot parse javascript file (getter syntax) Jan 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants