js_of_ocaml icon indicating copy to clipboard operation
js_of_ocaml copied to clipboard

[BUG] Using two Js_of_ocaml compiled libraries in the same runtime causes issues with js stubs

Open troederjs opened this issue 1 year ago • 3 comments

Describe the bug If two separate ocaml libraries have JS stubs which define the same symbol ion joo_global_object (e.g. two different versions of src-bindings/node/dune in the OCaml VSCode extension) they will conflict when both libraries are loaded by different Js_of_ocaml executable.

This happens because joo_global_object is the globalThis, and so the two values override each other.

Normally, when running a single application this is not a problem since we can control all the dependencies and ensure they don't conflict. But specifically in the case of the VSCode extension, this causes issues when there are two Js_of_ocaml extensions that use incompatible versions of the nodejs binding stubs.

Expected behavior Both Js_of_ocaml executable should be able to run independently in the same JS environment.

troederjs avatar Jun 10 '24 09:06 troederjs