I'm using ghcjs-0.2.0.9006030_ghc-7.10.3 with stack lts-6.30 to build a frontend app. Inspired by this post, I decided to use react-flux and material-ui. I added React's CDN link to my index.html, and configured GHCJSi to use a custom index-dev.html when working with the repl.(React's CDN link is also included in index-dev.html)
However, with material-ui-next, the official installation method is to use NPM. They provide no CDN link. So how to use this library in a GHCJS project? I think one of the following should work:
- Use the CDN link provided by jsDelivr. (Though this link doesn't work)
- Find some way to bundle
material-ui-nextand put it injs-sourcesfield in cabal, so that it can be linked with our app at build time.
Any help is appreciated.
In the package.json of material-ui, scripts
build:umd:prodandbuild:umd:devcan be used to build UMD bundles of the package. So you can use the CDN link provided by unpkg.Even though
material-uidoesn't declare a peer dependency onreact-transition-group, it expectsreact-transition-group/TransitionGroupto be present. So we have to add the following code before the link tomaterial-uiI created a issue on
material-ui's github repository, see that issue for more details.