[solved] Help installing bs-material-ui bindings


#1

In my first foray into 3rd party bindings installed from npm, and I seem to have run into some trouble! The bindings cannot be found, even though I’ve installed them with yarn: The module or file MaterialUI can’t be found. Here is my work so far:

bsb -init react-material -theme react
cd react-material/
yarn
yarn add wegry/bs-material-ui
yarn add  material-ui@next
yarn clean
yarn build
# this much works!

Add a component like:

let component = ReasonReact.statelessComponent("Header");

let make = (_children) => {
  ...component,
  render: (_self) =>
    <MaterialUI.AppBar position=`Static color=`Inherit>
      <MaterialUI.Toolbar>
        <MaterialUI.Typography variant=`Title color=`Inherit>
          (ReasonReact.string("Title"))
        </MaterialUI.Typography>
      </MaterialUI.Toolbar>
    </MaterialUI.AppBar>
};

And then rebuild, and I get

The module or file MaterialUI can’t be found.

Here is my bsconfig.json

{
  "name": "react-template",
  "reason": {
    "react-jsx": 2
  },
  "sources": {
    "dir" : "src",
    "subdirs" : true
  },
  "package-specs": [{
    "module": "commonjs",
    "in-source": true
  }],
  "suffix": ".bs.js",
  "namespace": true,
  "bs-dependencies": [
    "reason-react"
  ],
  "bs-dev-dependencies": ["bs-material-ui"],
  "refmt": 3
}

Note: I added wegry/bs-material-ui instead of InsidersByte/bs-material-ui because wegry has an open PR fixing some reason-react deprecation things.

The bsb -make-world step shows that it’s building the bindings which are in node_modules/bs-material-ui/src/MaterialUI.re

I am new to reasonml, so I may just be misunderstanding how bsb works.


#2

Update:

Part of the problem was the bs-dev-dependencies should have been
wegry/bs-material-ui

However, I ran into additional problems with these bindings, and then I discovered this package:

https://redex.github.io/package/@jsiebern/bs-material-ui

which seems to be in active development! (trying out yarn examples right now)


#3

It is active, yes. I’ll actually try to push an update today. Let me know if you face any issues.