Cautionary note for anyone reading this in the future: dynamic imports are asynchronous, and initializing the jsoo runtime takes some milliseconds, so that if you just do:
import("ocaml/export.bc.js");
var x = mylib.myfunction();
the second line will fail as mylib
is not defined yet (at least this is what I think is happening). You need to guarantee the module is done initializing in some way or other.