I have a Play framework project with client and server parts. The client part uses scala.js. I'm trying to use scalatags in the client side script.
In build.sbt for the project, I added "com.lihaoyi" %% "scalatags" % "0.5.5"
to the libraryDependencies. IntelliJ then gives me correct code completion for scalatags types. The page is the following:
package app
import scala.scalajs.js
import org.scalajs.dom
import scalatags.Text.all._
object App extends js.JSApp {
def main(): Unit = {
dom.document.getElementById("scalajsShoutOut").innerHTML = h1("Hello").render
}
}
However, when requesting the page I get compiler errors:
[error] Referring to non-existent class scalatags.Text$all$
[error] called from app.App$.main()scala.Unit
[error] called from scala.scalajs.js.JSApp$class.$$js$exported$meth$main(scala.scalajs.js.JSApp)java.lang.Object
[error] called from app.App$.$$js$exported$meth$main()java.lang.Object
[error] called from app.App$.main
[error] exported to JavaScript with @JSExport
[error] involving instantiated classes:
[error] app.App$
etc.
What other setup is required?
You have to use %%%
instead of %%
in the dependencies of a Scala.js project:
"com.lihaoyi" %%% "scalatags" % "0.5.5"