问题描述
我一直在使用scalajs-dom v 0.8.1,并尝试在我的SBT项目中混合使用webjar.当我这样做时,我得到了一个我无法弄清的最终的模棱两可的JS参考.我认为它介于我要使用的webjar(包括jquery v 2.1.4)和scala-js之间.我尝试使用ManifestFilters SBT过滤器,但它似乎无济于事(或者我不知道正确的语法).有人有调试此类错误的有用方法吗? (发出"fastOptJS"任务时,请参见下面的SBT输出)
I've been using scalajs-dom v 0.8.1 and trying to mix webjars within my SBT project. When I do this, I'm getting one final ambiguous JS reference that I can't figure out. I think it is between the webjars I want to use (that include jquery v 2.1.4) and scala-js. I tried using the ManifestFilters SBT filter but it does not seem to help (or I don't know the correct syntax). Does anyone have a useful way to debug these kinds of errors? (see below for SBT output when issuing the 'fastOptJS' task)
[error] - Ambiguous reference to a JS library: jquery.js
[error] Possible paths found on the classpath:
[error] - META-INF/resources/webjars/jquery/2.1.4/dist/jquery.js
[error] - META-INF/resources/webjars/jquery/2.1.4/src/jquery.js
[error] originating from: spJS:compile, spJS:compile
推荐答案
在下拉Webjar依赖项时,为jquery.js指定特定的子路径应消除歧义.
Specifying the specific subpath for jquery.js should disambiguate when pulling down webjar dependencies.
jsDependencies += "org.webjars" % "jquery" % "2.1.4" / "dist/jquery.js"
请参阅: https://github.com/scala-js/scala- js/issues/1496
这篇关于如何解决SBT项目中webjar和scala-js jar之间的JS依赖关系?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!