sbt-play-scalajs is a SBT plugin which allows you to use Scala.js along with Play Framework. It uses the sbt-web and scala-js plugins.
sbt-play-scalajs alternatives and similar packages
Based on the "Sbt plugins" category.
Alternatively, view sbt-play-scalajs alternatives based on common mentions on social networks and blogs.
coursier9.1 8.5 sbt-play-scalajs VS coursierPure Scala Artifact Fetching
sbt-native-packagersbt Native Packager
sbt-assembly8.9 2.8 sbt-play-scalajs VS sbt-assemblyDeploy über-JARs. Restart processes. (port of codahale/assembly-sbt)
sbt-dependency-graphsbt plugin to create a dependency graph for your project
sbteclipse7.8 8.8 sbt-play-scalajs VS sbteclipsePlugin for sbt to create Eclipse project definitions
sbt-scoveragesbt plugin for scoverage
sbt-jmh7.4 0.0 sbt-play-scalajs VS sbt-jmh"Trust no one, bench everything." - sbt plugin for JMH (Java Microbenchmark Harness)
sbt-release7.4 8.4 sbt-play-scalajs VS sbt-releaseA release plugin for sbt
sbt-revolver7.3 0.0 sbt-play-scalajs VS sbt-revolverAn SBT plugin for dangerously fast development turnaround in Scala
sbt-docker7.3 0.0 sbt-play-scalajs VS sbt-dockerCreate Docker images directly from sbt
sbt-updates7.1 8.1 sbt-play-scalajs VS sbt-updatessbt plugin that can check Maven and Ivy repositories for dependency updates
better-monadic-forDesugaring scala `for` without implicit `withFilter`s
tut6.9 1.1 sbt-play-scalajs VS tutdoc/tutorial generator for scala
sbt-buildinfoI know this because build.sbt knows this.
xsbt-web-pluginServlet support for sbt
sbt-pack6.3 9.1 sbt-play-scalajs VS sbt-packA sbt plugin for creating distributable Scala packages.
sbt-micrositesAn sbt plugin to create awesome microsites for your project
sbt-mima-pluginA tool for catching binary incompatibility in Scala
sbt-ensime6.1 0.0 sbt-play-scalajs VS sbt-ensimeGenerates .ensime config files for SBT projects http://ensime.org/build_tools/sbt
mdoc6.0 9.3 sbt-play-scalajs VS mdocTypechecked markdown documentation for Scala
splain5.7 5.3 sbt-play-scalajs VS splainbetter implicit errors for scala
sbt-sonatype5.7 8.9 sbt-play-scalajs VS sbt-sonatypeA sbt plugin for publishing Scala/Java projects to the Maven central.
scala-clippy5.5 0.0 sbt-play-scalajs VS scala-clippyGood advice for Scala compiler errors
sbt-ci-releasesbt plugin to automate Sonatype releases from GitHub Actions
sbt-site5.3 8.0 sbt-play-scalajs VS sbt-siteSite generation for sbt
sbt-dependency-checkSBT Plugin for OWASP DependencyCheck. Monitor your dependencies and report if there are any publicly known vulnerabilities (e.g. CVEs). :rainbow:
sbt-header5.0 6.7 sbt-play-scalajs VS sbt-headersbt-header is an sbt plugin for creating file headers, e.g. copyright headers
sbt-doctest4.6 9.0 sbt-play-scalajs VS sbt-doctestDoctest for scala
sbt-pgp4.5 0.0 sbt-play-scalajs VS sbt-pgpPGP plugin for sbt
sbt-scalafmt4.3 4.3 sbt-play-scalajs VS sbt-scalafmtsbt plugin for Scalafmt
sbt-unidoc4.1 5.7 sbt-play-scalajs VS sbt-unidocsbt plugin to create a unified Scaladoc or Javadoc API document across multiple subprojects.
sbt-api-mappingsAn Sbt plugin that fills apiMappings for common Scala libraries.
sbt-sublime3.9 0.0 sbt-play-scalajs VS sbt-sublimeAn sbt plugin for generating Sublime Text projects with library dependencies sources
sbt-robovm3.8 0.0 sbt-play-scalajs VS sbt-robovmAn sbt plugin for iOS development in Scala
sbt-groll3.6 0.0 sbt-play-scalajs VS sbt-grollsbt plugin to roll the Git history
sbt pom reader pluginTranslates xml -> awesome. Maven-ish support for sbt.
sbt-ghpages3.4 4.0 sbt-play-scalajs VS sbt-ghpagesgit, site and ghpages support for sbt projects.
ScalaKata23.3 0.0 sbt-play-scalajs VS ScalaKata2Interactive Playground
sbt-ide-settingsSBT plugin for tweaking various IDE settings
sbt-example2.7 9.2 sbt-play-scalajs VS sbt-exampleRun Scaladoc as unit tests
sbt-scala-js-mapA Sbt plugin that configures source mapping for Scala.js projects hosted on Github
sbt-haxe1.9 0.0 sbt-play-scalajs VS sbt-haxeA Sbt plugin to compile Haxe sources.
sbt-versions1.4 0.0 sbt-play-scalajs VS sbt-versionsPlugin that checks for updated versions of your project's dependencies.
sbt-hepek1.3 0.0 sbt-play-scalajs VS sbt-hepekSbt plugin for rendering Scala objects to files. And more!
sbt-pantarheisbt plugin building and publishing release notes from github pull requests
sbt-cppp1.2 0.0 sbt-play-scalajs VS sbt-cpppCross-Project Protobuf Plugin for Sbt
sbt-view1.0 0.0 sbt-play-scalajs VS sbt-viewSBT Plugin for Viewing ScalaDoc and JavaDoc
pttrt0.8 0.0 sbt-play-scalajs VS pttrtPass Them To Run-Time
sbt-classfinderSBT plugin for retrieving runtime information about the classes and traits in a project
Access the most powerful time series database as a service
Do you think we are missing an alternative of sbt-play-scalajs or a related project?
sbt-web-scalajs is a SBT plugin which allows you to use Scala.js along with any sbt-web server. It uses the sbt-web and scala-js plugins.
Specify the sbt version in
project/build.properties (you can find the latest version here):
Add the sbt-web-scalajs and Scala.js plugins to
addSbtPlugin("com.vmunier" % "sbt-web-scalajs" % "1.2.0") addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.5.1")
Lastly, put the following configuration in
lazy val server = project.settings( scalaJSProjects := Seq(client), Assets / pipelineStages := Seq(scalaJSPipeline) ).enablePlugins(SbtWeb) lazy val client = project.enablePlugins(ScalaJSPlugin, ScalaJSWeb)
Note: make sure you use the
To see the plugin in action, you can run
sbt new with one of these Giter8 templates:
- Play with Scala.js:
sbt new vmunier/play-scalajs.g8
- Akka HTTP with Scala.js:
sbt new vmunier/akka-http-scalajs.g8
Have a look at the releases to find out about the new features, bug fixes and how to upgrade when breaking changes were introduced.
sbt-web-scalajs looks up the
scalaJSStage setting from the Scala.js projects to know whether to run
scalaJSStagesetting is set to
FastOptStageby default, which means sbt-web-scalajs runs
scalaJSStage := FullOptStagecan be set in a Scala.js project, so that sbt-web-scalajs runs
fullLinkJSfor that project.
Global / scalaJSStage := FullOptStagesets
FullOptStagefor all the Scala.js projects from the build.
How it works
There are two plugins:
WebScalaJSis automatically added to your SbtWeb project.
ScalaJSWebshould be manually added to the Scala.js projects that are used by your SbtWeb project.
- Scala.js projects are collected in the
scalaJSProjectssetting key of the SbtWeb project. The plugin does nothing if
scalaJSProjectsis not specified or is empty.
- When compilation or testing takes place, then the
WebScalaJSplugin runs all required tasks on
scalaJSProjectsprojects, copies the output to sbt-web assets and takes care of Source Maps.
Settings and Tasks
scalaJSProjectssetting lists the Scala.js projects whose output are used by the server.
scalaJSPipeline performs the following tasks for each project defined in the
scalaJSStagesetting is equal to:
FastOptStage, then run
FullOptStage, then run
Read the ScalaJSWeb's
sourceMappingssetting from the project and its transitive dependencies.
sourceMappingslists the directories containing Scala files to be used for Source Maps. Copy all Scala files found in these directories to the sbt-web assets.
jsMappingstask runs Scala.js
fullLinkJSand convert output files to path mappings.
jsMappingsis scoped under
fullLinkJS. Let's have a look at the value of
> project client > show Compile/fastLinkJS/jsMappings [info] * (<path>/client/target/scala-2.13/client-fastopt/main.js.map,client-fastopt/main.js.map) [info] * (<path>/client/target/scala-2.13/client-fastopt/main.js,client-fastopt/main.js)
fastLinkJS, which creates two files:
main.js. The files are then converted to path mappings, i.e. a tuple of a file to a relative path. The
main.jsfile has a
main.jsto the server sbt-web assets under
We can extend
jsMappings to add the output of other Scala.js tasks. When using the sbt-jsdependencies plugin, we can update
jsMappings in build.sbt as follows:
import com.typesafe.sbt.web.PathMapping val client = project.settings( Compile / fastLinkJS / jsMappings += toPathMapping((Compile / packageJSDependencies).value), Compile / fullLinkJS / jsMappings += toPathMapping((Compile / packageMinifiedJSDependencies).value), ... ).enablePlugins(ScalaJSPlugin, ScalaJSWeb, JSDependenciesPlugin) def toPathMapping(f: File): PathMapping = f -> f.getName
sourceMappingssetting lists the directories containing Scala files to be used for Source Maps. The Scala files from the Scala.js project need to be copied and packaged, so that the server can serve these files to the browser when using Source Maps. Here's an example of what
> project client > show Compile/fastLinkJS/sourceMappings [info] * (<path>/client/src/main/scala, scala/ae0a44)The hash
ae0a44has been computed from the directory's canonical path using
sbt.io.Hash.trimHashString(f.getCanonicalPath, 6)and is used to configure the Scala.js
mapSourceURIscalac option. When generating Source Maps, Scala.js will replace the prefix path of each Scala file with its hash value. The hash uniquely identifies a file/directory and can be safely exposed to the users as the full file path is not disclosed.
The plugin copies the Scala files to the sbt-web assets, so that they can be served to the browser and used for Source Maps.
By default, Source Maps are enabled in both
However, Source Maps can easily be disabled in
fullLinkJS by adding the following line to the Scala.js project settings:
Compile / fullLinkJS / scalaJSLinkerConfig ~= (_.withSourceMap(false))
When Source Maps are disabled, the
.map files and the Scala files are not copied and do not exist in the sbt-web assets.
Note that Source Maps only get requested by the browser when the DevTools is open, so it does not hinder the performance of your website.
Scala.js continuous compilation
The plugin also watches files from the Scala.js projects.
compile to trigger
scalaJSPipeline when using
Compile / compile := ((Compile / compile) dependsOn scalaJSPipeline).value
Publish a new version of the plugin
New versions are automatically published to Sonatype when creating a git tag, thanks to sbt-ci-release.
*Note that all licence references and agreements mentioned in the sbt-play-scalajs README section above are relevant to that project's source code only.