This is completely fine, you can use reason-react with bs-platform@8.2.0.
I cloned the original rescript-project-template
on my machine, and this is how my full configuration looks like:
package.json
{
"name": "rescript-project-template",
"version": "0.0.1",
"scripts": {
"build": "bsb -make-world",
"clean": "bsb -clean-world",
"start": "bsb -make-world -w"
},
"keywords": [
"rescript"
],
"author": "",
"license": "MIT",
"devDependencies": {
"bs-platform": "8.2.0"
},
"dependencies": {
"reason-react": "^0.9.1"
}
}
bsconfig.json
{
"$schema": "https://raw.githubusercontent.com/rescript-lang/rescript-compiler/master/docs/docson/build-schema.json",
"name": "rescript-project-template",
"reason": {
"react-jsx": 3
},
"version": "0.0.1",
"sources": {
"dir" : "src",
"subdirs" : true
},
"package-specs": {
"module": "commonjs",
"in-source": true
},
"suffix": ".bs.js",
"bs-dependencies": [
"reason-react"
],
"warnings": {
"error" : "+101"
},
}
src/Demo.res
Js.log("Hello, World!")
let a = <div> {React.string("Hello world")} </div>
Running npm i
and npm run build
makes the whole thing compile for me.
Does your configuration look the same?
JSX desugars into certain function calls (check the JSX docs for more details on the desugaring mechanism). If you want to use JSX in general, you need to make sure to provide e.g. the div
function before using the JSX expression. Since JSX is mostly used with React, we usually assume you want to install reason-react
.