Reputation: 2429
I'm trying to write an app that's part ScalaJS and part Play framework. I'm using the ScalaJS bundler. It's bundling my JavaScript fine and I can see the resulting files where they are supposed to go.
But I noticed that only client-jsdeps.js
and client-fastopt.js
are available to the app. The reason for that is that their are the only files that are copied to the path server/target/web/public/main
. I have looked everywhere I could think, sbt
build files, config files, everywhere, and I could not find why those files are copied over and no other. I'd like the -bundle
files to be copied instead. Where is that setting?
It is worth noting that the two files that are packaged with the app do not appear in the user-editable path, server/public/js
, they are copied directly to the WAR file and therefore visible in the target
directory.
Upvotes: 2
Views: 380
Reputation: 9663
From the documentation:
For sbt-web integration use the sbt-web-scalajs-bundler
plugin instead of sbt-scalajs-bundler
:
addSbtPlugin("ch.epfl.scala" % "sbt-web-scalajs-bundler" % "0.13.1")
Then, enable the WebScalaJSBundlerPlugin
on the project that uses sbt-web:
lazy val server = project
.settings(
scalaJSProjects := Seq(client),
pipelineStages in Assets := Seq(scalaJSPipeline)
)
.enablePlugins(WebScalaJSBundlerPlugin)
lazy val client = project.enablePlugins(ScalaJSBundlerPlugin, ScalaJSWeb)
You also need to setup the ScalaJSBundlerPlugin
on the Scala.js project, as described in the preceding section, and
the sbt-web-scalajs
plugins as described in their documentation.
The 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.
Do you follow that guide?
Upvotes: 3