Add the libraries to the playground melange.emit stanza. This makes sure that the generated JS files will be available in node_modules for bundling
Add a Dune rule to generate the cmijs from the library so they can be compiled "live" in the playground. Add this cmijs.js file to both the playground-assets and the app.jsx entry point so they get loaded in the browser.
This is just a small example based on a Twitter convo with @ManasJayanth about exposing "regular" OCaml libraries in the playground.
The changes required are the following:
melange.emit
stanza. This makes sure that the generated JS files will be available innode_modules
for bundlingcmijs
from the library so they can be compiled "live" in the playground. Add thiscmijs.js
file to both theplayground-assets
and theapp.jsx
entry point so they get loaded in the browser.And a screen capture: