Js_of_ocaml-ppx not engaging


I have another problem with js_of_ocaml. While the compilation works fine now, I can’t get the js_of_ocaml-ppx to work. I can still use it, but for things like object%js I would really prefer the PPX to generate the necessary code itself.

I’ve created a sample here:

Whenever I try running it with jbuilder build (not even generating JS code here) it fails with:

         ppx collab_vis.pp.ml (exit 1)
(cd _build/default && ./.ppx/js_of_ocaml-ppx+ppx_driver.runner/ppx.exe --dump-ast -o collab_vis.pp.ml --impl collab_vis.ml)
File "collab_vis.ml", line 3, characters 12-14:
Error: Extension `js' was not translated

(I have added the ppx_driver.runner to trigger the error on build, but even without it I get errors in Merlin)

If I directly call _build/default/.ppx/js_of_ocaml-ppx+ppx_driver.runner/ppx.exe -print-transformations it doesn’t seem to have any transformations, just as if I left it out completely. First I thought this might be due to an ocaml-migrate-parsetree thing, but js_of_ocaml-ppx 3.0.1 seems to use OMP just fine.

Any ideas on how to coerce the PPX to run?

1 Like

If you want to combine ppx_driver-based ppxs with omp-based ones, you need to add -no-check after ppx_driver.runner in the pps section (this will be fixed in the next version of ppx_driver (source)).

Besides, using only (pps (js_of_ocaml-ppx)) works for me, including merlin support.

1 Like

Thanks, you are right. When I add -no-check it compiles just fine (or remove ppx_driver.runner), and on the example repository it worked with Merlin as well.

When trying it in my actual repository it does not work due to the FLG -ppx not being generated, which I was able to replicate fortunately.