Making a node module with js_of_ocaml
Making a node module with js_of_ocaml The js_of_ocaml documentation says about making a Node.js module: Js.export and Js.export_all will export a value to module.exports if it exists. What I'm confused about is the "if it exists" part. How do I make sure that the module def exists? i.e. if I'm making an OCaml library that I'd like to be able to import from JavaScript (TypeScript actually), how can I make sure that I get such a module as the output of js_of_ocaml ? js_of_ocaml 1 Answer 1 If module.exports exists, a value is exported as node module. And if module.exports doesn't exists (on web browser for example), a value is exported as global variable. module.exports module.exports Right, but how do I make "module.exports" exist in the generated JS code? – jmite 2 days ago ...
