These are chat archives for chandu0101/scalajs-react-components

31st
Mar 2016
elyphas
@elyphas
Mar 31 2016 01:20

Hi, I am using scalajs-spa-tutorial, but I want to use Elemental-ui's components from scalajs-react-components, but I got an error, "Uncaught TypeError: Cannot read property 'FormInput' of undefined", It is supposed that this error is because elemental doesn't load, but I have this setup in my Settings.scala:

val scalajsDependencies = Def.setting(Seq(
    "org.webjars.npm" %%% "elemental" % "0.5.13",
    ...
  ))
val jsDependencies = Def.setting(Seq(
      "org.webjars.npm" % "elemental" % "0.5.13" / "Elemental.js" commonJSName "Elemental",
...
  ))

How can I make sure that library's elemental is loaded?, or to force loading

also, this error apears: "Uncaught ReferenceError: exports is not defined"
elyphas
@elyphas
Mar 31 2016 01:32
by the way, It point me out this line: "exports.Alert = require('./components/Alert');"
Chandra Sekhar Kode
@chandu0101
Mar 31 2016 02:22
org.webjars.npm npm webjars doesn’t work out of the box always ..
Øyvind Raddum Berg
@oyvindberg
Mar 31 2016 06:46
@elyphas you will need npm/webpack or something like that - have a look at our demo project
Basically if you need modules, require or imports, sbt alone wont do
elyphas
@elyphas
Mar 31 2016 13:30
@oyvindberg ; thank you, in fact , I tried : ""org.webjars" % "webpack" % "1.5.3"", but I will going to try again. :)
Øyvind Raddum Berg
@oyvindberg
Mar 31 2016 14:56
ah no, you need a separate build step outside of sbt for the frontend resources
elyphas
@elyphas
Mar 31 2016 15:06
@oyvindberg ; somethin like this: "npm install", with the package.json, webpack.config.js, in my root directory, right?
Øyvind Raddum Berg
@oyvindberg
Mar 31 2016 15:17
yep
elyphas
@elyphas
Mar 31 2016 15:17
:)
Øyvind Raddum Berg
@oyvindberg
Mar 31 2016 15:17
check the aliases in package.json in the demo project
there you see start and build
elyphas
@elyphas
Mar 31 2016 15:18
ok
Øyvind Raddum Berg
@oyvindberg
Mar 31 2016 15:18
you can run them with npm run start (iirc)
i hate that we have to use this stuff, but sbt just doesnt support javascript modules yet :/
elyphas
@elyphas
Mar 31 2016 15:20
ah