Docs / Language Manual / Installation
Edit

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

(These docs are equivalent to the old BuckleScript docs before the ReScript rebrand)

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/rescript-project-template cd rescript-project-template 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!