Introduction to Reason Compilation
[CG]Nick
12.8K views
6 - Add a Third-Party Dependency
Thanks to our previous step, adding a new dependency is easy.
The OCaml compiler is package manager-agnostic. OPAM is the common one used by the community. Though if you're reading this tutorial, you likely know how to use npm. Good news: we support that as well. This tutorial will focus on the latter.
Usually we'd write a package.json here and let you do npm install
to install all the dependencies into ./node_modules
; for the sake of simplicity, we're gonna hardcode a dependency (check it out, it's only two files). You get the idea.
We'll also make the corresponding additions to .merlin
.
"Run"
1
2
3
4
5
6
print_endline MyDep.secret;
print_endline MyDep2.secret;
print_endline Muffin.secretFlavor;
1
let secret = "hello";
1
let secret = MyDep.secret ^ " world";
1
cd step6
Create your playground on Tech.io
This playground was created on Tech.io, our hands-on, knowledge-sharing platform for developers.