Thank you @patricoferris, your answer is very helpful.
Using a
.js
file with thejoo_global_object
approach like you pointed out
I want to make sure I understand the approach you’re taking here. JSOO outputs index.bc.js
, which includes require("@codemirror/view")
, require("@codemirror/state")
, etc. You then rely on Parcel (or Webpack, etc) to link the JS. Does that sound right?
This approach sounds very appealing since it’s simple on the OCaml side. It made your Codemirror bindings possible (which I could never figure out how to do). More generally, it solves the problem of working with JS modules from OCaml. I see two downsides:
- It’s an extra step for users
- Makes it possible to link an incompatible version of the JS library (as you noted)
By the way, I noticed @jchavarri debating some of the same questions: Should jsoo-react vendor react.js? · Issue #104 · ml-in-barcelona/jsoo-react · GitHub.