如何使用sbt- scalajs插件排除 scalajs依赖项? 我正在尝试导入以下库 "org.webjars.bower" % "react-bootstrap-datetimepicker" % "0.0.14" / "react-bootstrap-datetimepicker.js" 但是这个库正在下载已经存在于我的项
我正在尝试导入以下库
"org.webjars.bower" % "react-bootstrap-datetimepicker" % "0.0.14" / "react-bootstrap-datetimepicker.js"
但是这个库正在下载已经存在于我的项目中的其他依赖项(“react”和“react-bootstrap”),我正在进行版本冲突.
我尝试过使用exclude函数
"org.webjars.bower" % "react-bootstrap-datetimepicker" % "0.0.14" exclude ("org.webjars.bower", "react")
但这不允许我在命令中附加/“react-bootstrap-datetimepicker.js”.
我得到的例外是:
org.scalajs.core.tools.classpath.JSLibResolveException: Some references to JS libraries could not be resolved: - Ambiguous reference to a JS library: react-bootstrap.js Possible paths found on the classpath: - META-INF/resources/webjars/react-bootstrap/0.16.1/react-bootstrap.js - META-INF/resources/webjars/react-bootstrap/0.23.7/react-bootstrap.js originating from: adminJS:compile at org.scalajs.core.tools.classpath.PartialClasspath.resolveAllResourceNames(PartialClasspath.scala:137) at org.scalajs.core.tools.classpath.PartialClasspath.resolveDependencies(PartialClasspath.scala:80) at org.scalajs.core.tools.classpath.PartialClasspath.resolve(PartialClasspath.scala:64) at org.scalajs.sbtplugin.ScalaJSPluginInternal$$anonfun$11.apply(ScalaJSPluginInternal.scala:140) at org.scalajs.sbtplugin.ScalaJSPluginInternal$$anonfun$11.apply(ScalaJSPluginInternal.scala:137) at scala.Function1$$anonfun$compose$1.apply(Function1.scala:47) at sbt.$tilde$greater$$anonfun$$u2219$1.apply(TypeFunctions.scala:40) at sbt.std.Transform$$anon$4.work(System.scala:63) at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:226) at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:226) at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:17) at sbt.Execute.work(Execute.scala:235) at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:226) at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:226) at sbt.ConcurrentRestrictions$$anon$4$$anonfun$1.apply(ConcurrentRestrictions.scala:159) at sbt.CompletionService$$anon$2.call(CompletionService.scala:28) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745)exclude是sbt的libraryDependencies的一个特性,不会在jsDependencies中复制.因此,您无法直接在jsDependencies中声明排除.但是,由于jsDependencies构建在libraryDependencies之上,因此您可以通过组合两者来实现所需的一些重复代码:
libraryDependencies += "org.webjars.bower" % "react-bootstrap-datetimepicker" % "0.0.14" exclude ("org.webjars.bower", "react") jsDependencies += "org.webjars.bower" % "react-bootstrap-datetimepicker" % "0.0.14" / "react-bootstrap-datetimepicker.js"