Example or template projects for Scala 3 in Scala.js (Scala3.js)?

I’d be interested to see examples of projects (or template projects) that use Scala3 and Scala.js (even better if it supports cross builds, but multiple examples would be great). Mill or SBT would be fine, for instance.

Here’s an example that uses dotty nightly, so probably not quite what I’d be looking for at this point in time (Scala 3 is very close to release): GitHub - aappddeevv/dotty-scalajs: Example running dotty scalajs; uses nodejs to run the output script

4 Likes

Take any Scala.js for Scala 2 template, like GitHub - scala-js/scalajs-tutorial: Source code accompanying the Scala.js tutorial, then

  1. Make sure it uses sbt >= 1.5.0 and sbt-scalajs >= 1.5.0 (the same version numbers here are a coincidence)
  2. Set scalaVersion := "3.0.0-RC3" in the build
  3. If necessary, use .cross(CrossVersion.for3Use2_13) on dependencies as appropriate (e.g., in the above template, this is necessary on the scalajs-dom dependency).
  4. Enjoy!
7 Likes