我们可以在scalajs项目的%%%
中轻松使用build.sbt
,例如:
libraryDependencies +=
"com.lihaoyi" %%% "utest" % "0.3.0" % "test"
(现场演示:https://github.com/scala-js/scala-js-pickling/blob/master/build.sbt#L92)
但是当我尝试使用project/Build.scala
编写相同的构建文件时,它无法编译,我也不知道如何导入%%%
:
import org.scalajs.sbtplugin.cross.{CrossType, CrossProject}
import sbt._
import Keys._
object Build extends sbt.Build {
lazy val crossProject = CrossProject("server", "client", file("."), CrossType.Full)
.settings(
/* Shared settings */
libraryDependencies ++= Seq(
"io.github.widok" %%% "widok" % "0.2.1", // !!! can't compile
"com.lihaoyi" %%% "upickle" % "0.2.6")
)
.jsSettings(
/* Scala.js settings */
)
.jvmSettings(
/* JVM settings */
)
lazy val js = crossProject.js
lazy val jvm = crossProject.jvm
}
%%%
行不可编辑,如何解决?
答案 0 :(得分:5)
您需要添加以下导入
import org.scalajs.sbtplugin.ScalaJSPlugin.autoImport._