0

我正在尝试组合一个非常简单的项目。它可以编译,但是当我尝试run它时,它失败了:

[error] org.scalajs.jsenv.UnsupportedInputException: Unsupported input: List(CommonJSModule(/home/esgott/Repos/onlyco/target/scala-2.12/scalajs-bundler/main/onlyco-fastopt.js))
[error]         at org.scalajs.jsenv.jsdomnodejs.JSDOMNodeJSEnv.$anonfun$validateInput$1(JSDOMNodeJSEnv.scala:59)
[error]         at scala.collection.TraversableLike.$anonfun$map$1(TraversableLike.scala:238)
[error]         at scala.collection.immutable.List.foreach(List.scala:392)
[error]         at scala.collection.TraversableLike.map(TraversableLike.scala:238)
[error]         at scala.collection.TraversableLike.map$(TraversableLike.scala:231)
[error]         at scala.collection.immutable.List.map(List.scala:298)
[error]         at org.scalajs.jsenv.jsdomnodejs.JSDOMNodeJSEnv.validateInput(JSDOMNodeJSEnv.scala:54)
[error]         at org.scalajs.jsenv.jsdomnodejs.JSDOMNodeJSEnv.start(JSDOMNodeJSEnv.scala:35)
[error]         at org.scalajs.sbtplugin.Run$.runInterruptible(Run.scala:44)
[error]         at org.scalajs.sbtplugin.ScalaJSPluginInternal$.$anonfun$scalaJSConfigSettings$49(ScalaJSPluginInternal.scala:438)
[error]         at org.scalajs.sbtplugin.ScalaJSPluginInternal$.$anonfun$scalaJSConfigSettings$49$adapted(ScalaJSPluginInternal.scala:422)
[error]         at scala.Function1.$anonfun$compose$1(Function1.scala:49)
[error] stack trace is suppressed; run last Compile / run for the full output
[error] (Compile / run) org.scalajs.jsenv.UnsupportedInputException: Unsupported input: List(CommonJSModule(/home/esgott/Repos/onlyco/target/scala-2.12/scalajs-bundler/main/onlyco-fastopt.js))

项目代码位于https://github.com/esgott/onlyco。我一直在调试这个问题,你有线索吗?

4

1 回答 1

1

使用 scalajs-bundler 时,正如您似乎正在做的那样,仅指定jsEnvJSDOMNodeJSEnv. 相反,正如参考文档所说,您应该使用以下 scalajs-bundler-specific 设置:

requireJsDomEnv in Test := true
于 2020-09-18T15:41:53.940 回答