To be able to use a Scala library in Scala.js, it has to be separately compiled for Scala.js. You then can add it to your library dependencies as follows:
libraryDependencies += "org.scala-js" %%% "scalajs-dom" % "0.9.5"
%%% (instead of the usual
%% ) which will add the current Scala.js version to the artifact name
Note that you can also use
%%% in a Scala/JVM project, in which case it will be the same as
%% . This allows you to use the same
libraryDependencies settings when cross compiling Scala/JVM and Scala.js.
As both a library user and a library maintainer, this seems confusing to me (choosing the proper syntax and documenting both syntax options) . Why do we have two syntax options that do the same thing, but only one is valid in some situations? I’m aware there must be some technical reasons behind this, but shouldn’t we just deprecate one syntax and have a unified way of doing things?