|
| 1 | +--- |
| 2 | +title: "Migrate to v11 / Uncurried" |
| 3 | +description: "Instructions on upgrading to ReScript 11 with the new uncurried mode" |
| 4 | +canonical: "/docs/manual/latest/migrate-to-v11-and-uncurried-mode" |
| 5 | +--- |
| 6 | + |
| 7 | +# Migrate to ReScript 11 |
| 8 | + |
| 9 | +## Minimal Migration |
| 10 | + |
| 11 | +This guide describes the things to do at least to migrate to ReScript 11. |
| 12 | + |
| 13 | +### Disable uncurried mode |
| 14 | + |
| 15 | +If you use currying extensively and don't want to bother with adapting your code (or have dependencies ) |
| 16 | + |
| 17 | +```json |
| 18 | +{ |
| 19 | + "uncurried": false |
| 20 | +} |
| 21 | +``` |
| 22 | + |
| 23 | +## Recommended Migration |
| 24 | + |
| 25 | +### Uncurried Mode |
| 26 | + |
| 27 | +For uncurried mode to take effect in ReScript 11 there is nothing to configure, it is activated by default. |
| 28 | + |
| 29 | +### Adapt suffix |
| 30 | + |
| 31 | +ReScript 11 now allows having arbitrary suffixes in the generated JavaScript files. However it is still recommended to stick to using `.res.js`, `.res.mjs` or `.res.cjs`. For more information, read the Build System Configuration about [suffixes](/docs/manual/latest/build-configuration#suffix). |
| 32 | + |
| 33 | +### rescript.json |
| 34 | + |
| 35 | +The old configuration filename `bsconfig.json` is finally deprecated. Rename it to `rescript.json`. |
| 36 | + |
| 37 | +### ReScript-Core standard library |
| 38 | + |
| 39 | +There is a new standard library in development that can already be installed called ReScript-Core. It replaces the complete `Js` module as well as some of the more frequently used modules from `Belt` and is the recommended standard library to use with uncurried mode. At a later stage it will be integrated into the compiler while `Belt` will be maintaned as a separate npm package. |
| 40 | + |
| 41 | +Until it's integrated in the compiler, it needs to be installed manually: |
| 42 | + |
| 43 | +```console |
| 44 | +$ npm install @rescript/core |
| 45 | +``` |
| 46 | + |
| 47 | +Then add `@rescript/core` to your `rescript.json`'s dependencies: |
| 48 | + |
| 49 | +```diff |
| 50 | + { |
| 51 | + "bs-dependencies": [ |
| 52 | ++ "@rescript/core" |
| 53 | + ] |
| 54 | + } |
| 55 | +``` |
| 56 | + |
| 57 | +Open it so it's available in the global scope. |
| 58 | + |
| 59 | +```diff |
| 60 | + { |
| 61 | + "bsc-flags": [ |
| 62 | ++ "-open RescriptCore", |
| 63 | + ] |
| 64 | + } |
| 65 | +``` |
| 66 | + |
| 67 | +For a detailed explanation on migration to ReScript-Core, please refer to its [migration guide](https://github.com/rescript-association/rescript-core#migration). A semi-automated script is available as well. |
| 68 | + |
| 69 | +**Note**: ReScript-Core API docs will be added to this documentation platform at a later stage. For now check out the `.resi` files in the repository or, more conveniently, read the docs for a certain module or function directly in the editor tooling. |
| 70 | + |
| 71 | +### Removed bindings |
| 72 | + |
| 73 | +Many Node bindings have been removed from the compiler. Please use [rescript-nodejs](https://github.com/TheSpyder/rescript-nodejs) instead or write your own local bindings. |
0 commit comments