Ah, I haven’t used the preserve mode before. Now I got it.
If you don’t use e.g. react in preserve mode, the compiler throws an error. Probably a bug? Don’t know.
I have a workaround for you. It is the most minimal working example I could build in a few minutes.
If you need components etc. you have to mock some more stuff I think.
rescript.json
"jsx": {
"version": 4,
"module": "JSX",
"preserve": true
}
JSX.res
type element = Jsx.element
module Elements = {
external jsx: (string, JsxDOM.domProps) => element = "jsx"
external jsxs: (string, JsxDOM.domProps) => element = "jsx"
external someElement: element => option<element> = "%identity"
}
Now this code:
Console.log(<div>{Jsx.string("hello world")}</div>)
Will be compiled to this one:
console.log(<div>
{"hello world"}
</div>);