You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: markdown-pages/docs/manual/migrate-to-v12.mdx
+28-1Lines changed: 28 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,7 +14,7 @@ If you encounter any missing information or issues during migration, please [ope
14
14
15
15
- ReScript V11 project.
16
16
- Uncurried mode must be enabled (i.e. you have not opted-out from it)
17
-
- Your project must not contain any OCaml source code anymore, as support for `.ml` files is removed in this version. However there are ways to convert OCaml syntax with an older ReScript compiler version (see below).
17
+
- Your project must not contain any OCaml source code anymore, as support for `.ml` files is removed in this version. However there are ways to convert OCaml syntax with an older ReScript compiler version ([see below](#converting-generated-ml-files)).
18
18
- The old configuration filename that was deprecated in v11, `bsconfig.json`, is removed. Rename it to `rescript.json`.
19
19
- Minimum supported Node.js version is 20.0.0
20
20
@@ -188,3 +188,30 @@ rescript watch
188
188
# format
189
189
rescript format
190
190
```
191
+
192
+
## Converting generated `.ml` files
193
+
194
+
Some projects still rely on tools such as `atdgen` that emit OCaml `.ml` files. ReScript 12 cannot compile those files directly, so you must keep using ReScript 11 **only** to convert the generated `.ml` files back to `.res` files before you run the v12 build.
195
+
196
+
1. Keep ReScript 12 as the sole compiler dependency in your main project (i.e. `devDependencies.rescript` stays at `^12.0.0`).
197
+
198
+
2. Install ReScript 11 in a dedicated subfolder (so its binaries never replace the v12 ones in `node_modules/.bin`). A simple option is to store it under a subfolder, e.g. `tools` (if you're using workspaces, keep this folder out of the root workspace list so hoisting can't swap the v12 shims):
199
+
200
+
`cd` into `tools` and run `npm create rescript-app` and select the basic template and a v11 version of ReScript. You can name it `rescript-11` for instance.
201
+
202
+
3.`cd` back into the root of your project and add a helper script that references the compiler from that folder (adapt the path accordingly):
4. Execute the helper script to convert your `.ml` files to `.res` files:
213
+
```console
214
+
npm run convert-ml
215
+
```
216
+
217
+
This setup is an escape hatch. It keeps legacy generators like `atdgen` working but it also forces you to maintain two compiler versions. Whenever possible migrate such things to modern ReScript tooling such as [Sury](https://github.com/DZakh/sury/).
0 commit comments