我正在尝试编写一部分ScalaJS和一部分Play框架的应用程序。我正在使用ScalaJS捆绑器。它很好地捆绑了我的JavaScript,我可以看到生成的文件应该放在哪里。
但我注意到只有client-jsdeps.js
且client-fastopt.js
可用于该应用程序。这样做的原因是,它们是唯一复制到路径的文件server/target/web/public/main
。我到处都是我想过的地方,生成sbt
文件,配置文件,到处都找不到,为什么找不到这些文件被复制的原因。我想-bundle
改为复制文件。那地方在哪里?
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.
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.
您可以在此处看到完整的示例。
您是否遵循该指南?
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句