-
Notifications
You must be signed in to change notification settings - Fork 31
Open
Description
gen_js_api seems to advertise mutating the global object in order to make js values accessible on the OCaml side using [@@js.get ], [@@js.global], ...
For example,
cat node-test/bindings/imports.mli
[@@@js.scope "__LIB__NODE__IMPORTS"]
val path: Ojs.t [@@js.global]
val fs: Ojs.t [@@js.global]cat node-test/bindings/imports.js
globalThis.__LIB__NODE__IMPORTS = {
path: require('path'),
fs: require('fs'),
};This causes problems when loading multiple js files generated by jsoo because one could override a global value with an incompatible one , see ocsigen/js_of_ocaml#1622 and ocamllabs/vscode-ocaml-platform#1617.
I'm opening this to understand if this issue has already been solved, if it has already been identified and discuss possible solutions.
Note that jsoo is able to bind to js libs relying on external primitives without mutating the global object.
smorimoto
Metadata
Metadata
Assignees
Labels
No labels