2

私は、クロスビルドアプローチを使用して、Scalatags ... アプリを使用した古典的な ScalaJS に取り組んでいます。

<root folder>
- client
- project
- server
- shared
- build.sbt

実行中は問題なく動作します。sbt re-startまたはsbt run-main WebServersbt-native-pagkagerプラグインを使用して、すべてのものをパッケージ化し、プロジェクトの開始スクリプトを生成したいと考えています。

開始スクリプトの生成は機能しますが、ScalaJS の fastOptJs は含まれていないようです。

ここで役立つはずの何かがありますが、私の場合は間違いありません。

ところで、私のbuild.sbtファイルは次のようになります。

val scalaV = "2.12.2"

lazy val server = (project in file("server"))
  .settings(
    scalaVersion := scalaV,
    scalaJSProjects := Seq(client),
    pipelineStages in Assets := Seq(scalaJSPipeline),
    // triggers scalaJSPipeline when using compile or continuous compilation
    compile in Compile := ((compile in Compile) dependsOn scalaJSPipeline).value,
    libraryDependencies ++= Seq(
      ...
    ),

    WebKeys.packagePrefix in Assets := "public/",
    (managedClasspath in Runtime) += (packageBin in Assets).value,
    // Packaging
    topLevelDirectory := None // Don't add a root folder to the archive
  )
  .enablePlugins(SbtWeb, JavaAppPackaging)
  .dependsOn(sharedJvm)

lazy val client = (project in file("client"))
  .settings(
    scalaVersion := scalaV,
    scalaJSUseMainModuleInitializer := true,
    unmanagedSourceDirectories in Compile := Seq((scalaSource in Compile).value),
   libraryDependencies ++= Seq(
     ...
   ),
  jsDependencies ++= Seq(
     ...
  )
)
.enablePlugins(ScalaJSPlugin, ScalaJSWeb)
.dependsOn(sharedJs)

lazy val shared = (crossProject.crossType(CrossType.Pure) in file("shared"))
  .enablePlugins(BuildInfoPlugin)
  .settings(
     scalaVersion := scalaV,
     libraryDependencies ++= Seq(
        ...
     ),
     // build info
    buildInfoOptions += BuildInfoOption.BuildTime,
    buildInfoKeys := Seq[BuildInfoKey](
    ),
    buildInfoPackage := "com.example.build"
  )
  .jsSettings(
     libraryDependencies ++= Seq(
      ...
     )
  )
 .jsConfigure(_ enablePlugins ScalaJSWeb)

 ....

何か助けはありますか?どうもありがとう!

4

1 に答える 1