【发布时间】:2016-08-17 22:13:20
【问题描述】:
当我几个月前第一次发现 webJars 时,我非常怀疑这是否是一种处理客户端依赖项的可行方法,因为其中一些构建/构建系统非常复杂,并且考虑到 @ 987654322@ 文件已发布。第二个担忧当然没有充分的根据,但我觉得第一个问题是正确的,因为我花了将近 36 个小时现在徒劳地试图让大约 10 个scss/css/less-type webJars 和 8 个 JS webJars 生活在一个 jsDependencies 屋顶下。
当你达到 JS 依赖项 3、4 或 5 时,我发现你开始进入一个荒谬的 timekill 循环:
1。 “哦,不!fastOptJS 失败了,因为有一些随机文件也与 webjar 中的依赖项命名相同!”
[trace] Stack trace suppressed: run last client/compile:resolvedJSDependencies for the full output.
[error] (client/compile:resolvedJSDependencies) org.scalajs.core.tools.jsdep.JSLibResolveException: Some references to JS libraries could not be resolved:
[error] - Ambiguous reference to a JS library: bootstrap.min.js
[error] Possible paths found on the classpath:
[error] - META-INF/resources/webjars/bootstrap/3.3.6/js/bootstrap.min.js
[error] - META-INF/resources/webjars/bootstrap3-dialog/1.34.4/examples/assets/bootstrap/js/bootstrap.min.js
[error] originating from: client:compile, client:compile, client:compile, client:compile
[error] - Ambiguous reference to a JS library: bootstrap.js
[error] Possible paths found on the classpath:
[error] - META-INF/resources/webjars/bootstrap3-dialog/1.34.4/examples/assets/bootstrap/js/bootstrap.js
[error] - META-INF/resources/webjars/bootstrap/3.3.6/js/bootstrap.js
[error] originating from: client:compile, client:compile, client:compile, client:compile
2。我知道要做什么!我给定义的js加个版本!
lazy val webjarbs = "org.webjars" % "bootstrap" % version.bootstrap / s"${version.bootstrap}/bootstrap.js" minified s"${version.bootstrap}/bootstrap.min.js" dependsOn "jquery.js" commonJSName "bootstrap"
3。 “哦不!fastOptJS 失败了!”
[trace] Stack trace suppressed: run last client/compile:resolvedJSDependencies for the full output.
[error] (client/compile:resolvedJSDependencies) org.scalajs.core.tools.jsdep.JSLibResolveException: Some references to JS libraries could not be resolved:
[error] - Missing JS library: 3.3.6/bootstrap.js
[error] originating from: client:compile, client:compile, client:compile, client:compile
[error] - Missing JS library: 3.3.6/bootstrap.min.js
[error] originating from: client:compile, client:compile, client:compile, client:compile
男孩们。
这样一遍又一遍,然后我必须开始做
lazy val bs_sidebar = ( "org.webjars" % "bootstrap-sidebar" % version.bs_sidebar intransitive()) / "js/sidebar.js" dependsOn(s"bootstrap.js", s"bootstrap.min.js")
现在我什至没有真正使用 webjar,但它有一个名为 X 的 js依赖项,我无法更改它...
问题
嗯?如果我只是做了我过去常做的事情,只是将没有应用程序的依赖项构建到某个巨大的文件或一组文件中,然后将其输入到构建中怎么办?我有一个来自网上的概念证明,我得到了它的工作(我认为它是 https://github.com/wav/material-ui-scalajs-react/blob/master/src/main/scala/wav/web/muiwrapper/package.scala )几乎工作,并给了我这个想法。
我知道npm 比sbt, 工作得更好,而且我仍然可以将它放入我的包中...有什么缺点,我是否遗漏了一些关于 sbt 的内容?
【问题讨论】:
标签: node.js sbt scala.js sbt-web