scalajs-bundler

scalajs-bundler

scalajs-bundler is a module bundler for Scala.js projects that use npm packages: it bundles the .js file emitted by the Scala.js compiler with its npm dependencies into a single .js file executable by Web browsers.

scalajs-bundler uses npm and webpack under the hood.

Last stable version is 0.21.1+36-2d9cbce2-SNAPSHOT:

// For Scala.js 1.x
addSbtPlugin("ch.epfl.scala" % "sbt-scalajs-bundler" % "0.21.1+36-2d9cbce2-SNAPSHOT")
// Or, for Scala.js 0.6.x
addSbtPlugin("ch.epfl.scala" % "sbt-scalajs-bundler-sjs06" % "0.21.1+36-2d9cbce2-SNAPSHOT")

If you're using sbt-crossproject you need to add plugin via jsConfigure:

lazy val cross = crossProject(JSPlatform, JVMPlatform).in(file("."))
  .jvmSettings(BuildSettings.jvmSettings)
  .jsSettings(BuildSettings.jsSettings)
  .jsConfigure { project => project.enablePlugins(ScalaJSBundlerPlugin) }

See the getting started page for more details about the setup process.