Docs / Language Manual / Installation

You are currently looking at the v8.0.0 docs (Reason v3.6 syntax edition). You can find the latest manual page here.

Installation

Prerequisite: NPM, which comes with NodeJS. Yarn also works.

To install ReScript globally:

SH
npm install -g bs-platform

New Project

Note: this starts a new project with the new syntax, not the old Reason syntax.

SH
git clone https://github.com/rescript-lang/new-project cd new-project npm install npm run build node src/Demo.bs.js

That compiles your ReScript into JavaScript, then uses NodeJS to run said JavaScript. We recommend you use our highly unique workflow of keeping a tab open for the generated .bs.js file, so that you can learn how ReScript transforms to JavaScript. Not many languages output clean JavaScript code you can manually inspect!

During development, instead of running npm run build each time to compile, use npm run start to start a watcher that recompiles automatically after file changes.

Alternatively, to start a ReasonReact app, follow the instructions here.

Integrate Into Existing JS Project

You can install the toolchain locally to an existing JS project, through the familiar command:

SH
npm install --save-dev bs-platform

The rest is the same as above. Since we output clean .bs.js files, the rest of your existing toolchain (e.g. Babel and Webpack) should mostly just work. Nothing to learn on the bundling side!