SBT: error: not found: value npmDependencies npmDependencies in Compile ++= Seq(...)

SBT: error: not found: value npmDependencies npmDependencies in Compile ++= Seq(...)

我尝试使用 [ScalablyTyped][1] 开始一个项目。

启动 sbt 时出现以下异常:

error: not found: value npmDependencies

npmDependencies in Compile ++= Seq("d3" -> "5.5.0")

这是我的 plugin.sbt:

resolvers += Resolver.bintrayRepo("oyvindberg", "ScalablyTyped")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.26")
addSbtPlugin("org.scalablytyped" % "sbt-scalablytyped" % "201904160530")

和我的 Builod.sbt:

enablePlugins(ScalaJSPlugin)

name := "Scala.js Tutorial"
scalaVersion := "2.12.6" 
resolvers += Resolver.bintrayRepo("oyvindberg", "ScalablyTyped")
libraryDependencies ++= Seq(ScalablyTyped.D.d3)
npmDependencies in Compile ++= Seq("d3" -> "5.5.0")

npmDependencies 是由 scalajs-bundler 提供的密钥,因此您需要在 project/plugins.sbt 中添加以下行:

addSbtPlugin("ch.epfl.scala" % "sbt-scalajs-bundler" % "0.14.0")

并在 build.sbt

enablePlugins(ScalaJSBundlerPlugin)