diff --git a/pages/docs/manual/latest/build-external-stdlib.mdx b/pages/docs/manual/latest/build-external-stdlib.mdx index ae796932c..2f29e4b7a 100644 --- a/pages/docs/manual/latest/build-external-stdlib.mdx +++ b/pages/docs/manual/latest/build-external-stdlib.mdx @@ -24,10 +24,12 @@ To solve that, we now publish our runtime as a standalone package at [`@rescript Say you want to publish a JS-only ReScript 9.0 library. Install the packages like this: ```sh -npm install rescript@11.0.1 --save-dev +npm install rescript@11.0.1 npm install @rescript/std@11.0.1 ``` +> Note: When ReScript 12 releases, it will ship with the ReScript Core standard library and `rescript` can be installed as a `--dev` dependency again. + Then add this to `rescript.json`: ```json @@ -37,6 +39,21 @@ Then add this to `rescript.json`: } ``` +Make sure you are using commonjs because only `.mjs` files are published with ReScript Core: + +```json +{ + // ... + "package-specs": [ + { + "module": "esmodule", + "in-source": true + } + ], + "suffix": ".mjs", +} +``` + Now the compiled JS code will import using the path defined by `external-stdlib`. Check the JS output tab: