Build System Overview

ReScript comes with a build system, bsb, that's meant to be fast, lean and used as the authoritative build system of the community.

The build description file is called bsconfig.json. Every ReScript project needs one.

Build Project

Each build will create build artifacts from your project's source files.

To build a project (including its dependencies / pinned-dependencies), run:

SH
bsb -make-world

Add -w to keep the built-in watcher running. Any new file change will be picked up and the build will re-run.

Note: third-party libraries (in node_modules, or via pinned-dependencies) aren't watched, as doing so may exceed the node.js watcher count limit.

Note 2: In case you want to set up a project in a JS-monorepo-esque approach (yarn workspaces / lerna) where changes in your sub packages should be noticed by the compiler (bsb -make-world), you will need to define pinned dependencies in your main project's bsconfig.json. More details here.

To build only your project's files (without dependencies), run:

SH
bsb

Clean Project

If you ever get into a stale build for edge-case reasons, use:

SH
bsb -clean-world

This will clean all your project's build artifacts, including those in your dependencies. Alternatively you can run bsb -clean to clean your project's build artifacts only.

For more infos, run bsb -help to see all the available options.