cca-io / rescript-mui

ReScript bindings for MUI
MIT License
255 stars 52 forks source link

Rescript incompatibility #120

Closed montogeek closed 3 years ago

montogeek commented 3 years ago

Hi!

I just installed these bindings in a Rescript project, unfortunately I am getting the following error:

  It's possible that your build is stale.
  Try to clean the artifacts and build again?

  Here's the original error message
  The files /Users/fernando/Code/rescript/node_modules/@jsiebern/bs-material-ui/lib/ocaml/materialUi.cmi
  and /Users/fernando/Code/rescript/node_modules/@rescript/react/lib/ocaml/react.cmi
  make inconsistent assumptions over interface React

FAILED: cannot make progress due to previous errors.
>>>> Finish compiling(exit: 1)

My code:

// Main.res
@react.component
let make = () => {
  open MaterialUi
  <Container>
    {React.string("Hello World")}
  </Container> 
}

package.json

{
  "scripts": {
    "re:build": "bsb -make-world -clean-world",
    "re:watch": "bsb -make-world -clean-world -w"
  },
  "dependencies": {
    "@jsiebern/bs-material-ui": "2.0.2",
    "@material-ui/core": "4.11.3",
    "@rescript/react": "0.10.1",
    "react": "17.0.1",
    "react-dom": "17.0.1",
    "reason-react": "^0.9.1",
    "snowpack": "3.0.11"
  }
}

bsconfig.json

{
  "name": "rescript",
  "reason": { "react-jsx": 3 },
  "bs-dependencies": ["@rescript/react", "@jsiebern/bs-material-ui"],
  "bsc-flags": ["-bs-super-errors"],
  "sources": [
    {
      "dir": "src",
      "subdirs": true
    }
  ],
  "package-specs": [
    {
      "module": "es6",
      "in-source": true
    }
  ],
  "suffix": ".bs.js",
  "namespace": true,
  "ppx-flags": [],
  "refmt": 3
}

It is there anything I can do to make it work? Thanks!

jsiebern commented 3 years ago

One of the minor breaking changes here must be affecting the package. I'll get on that this weekend, thank you for bringing it up. In the meantime, please just use reason-react@0.9 instead of @rescript/react. You should not feel any difference working with the "older" version at the moment I think.

montogeek commented 3 years ago

Thanks, got it working by doing:

  1. Installing npm i -S -E reason-react@0.9
  2. Update bs-dependency from @rescript/react to reason-react.
jsiebern commented 3 years ago

That's great. Just don't foget to eventually switch it back when I find the time to fix it with the bindings, the @rescript/react package is surely the one to move forward with :-)

montogeek commented 3 years ago

@jsiebern Thank you!