Forked from this original template and changed to use Vite and Tailwind. This template uses only Reason syntax and not OCaml.
A simple project template using Melange with opam.
If you are looking for a template with esy, check melange-esy-template.
make init
# In separate terminals:
make watch
make dev
React support is provided by reason-react
. The entry point of the sample React app is src/Index.re
.
To enable React fast refresh, write .rei
interface files for each component.
You can see all available commands by running make help
or just make
. Here
are a few of the most useful ones:
make init
: set up opam local switch and download OCaml, Melange and JavaScript dependenciesmake install
: install OCaml, Melange and JavaScript dependenciesmake watch
: watch for the filesystem and have Melange rebuild on every changemake dev
: serve the JS application with a local HTTP servermake bundle
: create production build of appmake preview
: serve the production build of the JS application with a local HTTP server
Since Melange just compiles source files into JavaScript files, it can be used for projects on any JavaScript platform - not just the browser.
This template includes just one melange.emit
stanza and not the two stanzas from the original template. Please refer to the original template to see how to output JS code for the browser and node using two separate stanzas.
_build/default/src/output/src/Index.js
in index.html
is used as the entry point for Vite.