Skip to content

update installation section #1030

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 10, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 19 additions & 24 deletions pages/docs/manual/v12.0.0/installation.mdx
Original file line number Diff line number Diff line change
@@ -5,23 +5,23 @@ canonical: "/docs/manual/v12.0.0/installation"
---

# Installation

## Notes

With the instructions below, our new standard library [ReScript Core](https://github.com/rescript-association/rescript-core) will be included by default. (In ReScript 11, it comes as a separate npm package `@rescript/core`. In future versions, it will be included in the `rescript` npm package itself.)

## Prerequisites

- [Node.js](https://nodejs.org/) version >= 14
- [Node.js](https://nodejs.org/) version >= 20
- One of the following package managers:
- [npm](https://docs.npmjs.com/cli/) (comes with Node.js)
- [yarn](https://yarnpkg.com/) (yarn versions >1 need to set `nodeLinker: node-modules` in `.yarnrc.yml`)
- [yarn](https://yarnpkg.com/)
- yarn versions >1 need to set `nodeLinker: node-modules` in `.yarnrc.yml`
- [pnpm](https://pnpm.io/)
- [bun](https://bun.sh/)
- [deno](http://deno.com/)
- Configure `"nodeModulesDir": "auto"` in `deno.json`

## New Project

The fastest and easiest way to spin up a new ReScript project is with the [create-rescript-app](https://github.com/rescript-lang/create-rescript-app) project generator. You can start it with any of the aforementioned package managers or `npx`.
The fastest and easiest way to spin up a new ReScript project is with the [create-rescript-app](https://github.com/rescript-lang/create-rescript-app) project generator. This will get you started with a fresh Next.js or Vite app with React and Tailwind CSS.

You can start it with any of the aforementioned package managers or `npx`.

<CodeTab labels={["npm", "npx", "yarn", "pnpm", "bun"]}>

@@ -40,7 +40,6 @@ pnpm create rescript-app
```sh
bun create rescript-app
```

</CodeTab>

- Follow the steps of the setup.
@@ -83,28 +82,30 @@ pnpm create rescript-app
```sh
bun create rescript-app
```

</CodeTab>

`create-rescript-app` will tell you that a `package.json` file has been detected and ask you if it should install ReScript into your project. Just follow the steps accordingly.

### Manual Setup
- Install ReScript locally:
<CodeTab labels={["npm", "yarn", "pnpm", "bun"]}>
<CodeTab labels={["npm", "yarn", "pnpm", "bun", "deno"]}>

```sh
npm install rescript @rescript/core
npm install rescript
```
```sh
yarn add rescript @rescript/core
yarn add rescript
```
```sh
pnpm install rescript @rescript/core
pnpm install rescript
```
```sh
bun install rescript @rescript/core
bun install rescript
```
```sh
// you will need deno configured to have a node_modules folder
deno install npm:rescript --allow-scripts
```

</CodeTab>
- Create a ReScript build configuration file (called `rescript.json`) at the root:
```json
@@ -122,13 +123,7 @@ bun create rescript-app
"in-source": true
}
],
"suffix": ".res.js",
"bs-dependencies": [
"@rescript/core"
],
"bsc-flags": [
"-open RescriptCore"
]
"suffix": ".res.js"
}
```
See [Build Configuration](build-configuration) for more details on `rescript.json`.
@@ -140,7 +135,7 @@ bun create rescript-app
}
```

Since ReScript compiles to clean readable JS files, the rest of your existing toolchain (e.g. Babel and Webpack) should just work!
Since ReScript compiles to clean readable JS files, the rest of your existing toolchain (e.g. Vite, Rspack, Rollup) should just work!

Helpful guides: