You need to have
npm installed on your system.
sbt-scalajs-bundler plugin to your Scala.js project, in your
Note that the plugin requires Scala.js 0.6.22+ and either sbt 0.13.16+ or 1.0.0-RC2+.
ScalaJSBundlerPlugin, in your
If you have a
main method, make sure that you enable the Scala.js main module initializer with the following setting:
Add dependencies to the npm packages your application requires, in your
build.sbt file, e.g.:
Then, use the
fastOptJS::webpack sbt command to download the npm packages and bundle your Scala.js
See complete examples in the tests.
For sbt-web integration use the
sbt-web-scalajs-bundler plugin instead of
Then, enable the
WebScalaJSBundlerPlugin on the project that uses sbt-web:
You also need to setup the
ScalaJSBundlerPlugin on the Scala.js project, as described in the preceding section, and
sbt-web-scalajs plugins as described in their documentation.
WebScalaJSBundlerPlugin plugin automatically configures the
scalaJSPipeline task to use
the bundles rather than the output of the Scala.js compilation.
You can see a complete example here.