Skip to content

Installation

  • Scala 3.x (tested with 3.8.3)
  • Scala.js 1.x (tested with 1.21.0)
  • Node.js (runtime)
  • sbt (build tool)

Add Apion to your build.sbt:

libraryDependencies += "io.github.edadma" %%% "apion" % "0.1.0"

A minimal build.sbt for a Scala.js project using Apion:

ThisBuild / scalaVersion := "3.8.3"
enablePlugins(ScalaJSPlugin)
scalaJSLinkerConfig ~= { _.withModuleKind(ModuleKind.CommonJSModule) }
libraryDependencies += "io.github.edadma" %%% "apion" % "0.1.0"

Also add the sbt-scalajs plugin in project/plugins.sbt:

addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.21.0")
Terminal window
# Compile and link
sbt fastLinkJS
# Run with Node.js
node target/scala-3.8.3/project-fastopt/main.js

For development with auto-restart, you can use nodemon:

Terminal window
npx nodemon --watch target -e js --exec "node target/scala-3.8.3/project-fastopt/main.js"