Node.js   发布时间:2022-04-24  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了node.js – 在ScalaJs sbt构建中,使用webjars而不是“提供”的npm或bower有什么优势吗?大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
当我几个月前第一次发现webJars时,我对此持怀疑态度,因为这些构建/构建系统中的一些构建/构建系统的复杂性非常大,并且虑到js文件发布的频率,这将是一种处理客户端依赖关系的可行方法.第二个问题当然不是有根据的,但是经过花费近36个小时的时间,我觉得第一个关心是无庸置疑的,现在尝试使用大约10个scss / css / less-type webJars和8个JS webJars来生活在一个jsDependencies屋顶下.

当我遇到JS依赖关系3,4或5的时候,我发现了这样一个可笑的时间循环:

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
[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

我知道该怎么办我将添加一个版本到定义的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"

“哦不,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
[error] - Missing JS library: 3.3.6/bootstrap.min.js
[error]   originaTing from: client:compile,client:compile

gg男孩.

这样一来又一遍又一遍,然后我就要开始做

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的jsependencies,我不能改变那个…

嗯?如果我只是做了我以前做的工作,而是将应用程序建立在一些巨大的文件或一组文件中,然后将其加载到构建中的依赖项?我有一个在线的概念证明,我得到它的工作(我认为是https://github.com/wav/material-ui-scalajs-react/blob/master/src/main/scala/wav/web/muiwrapper/package.scala)几乎工作,并给了我的想法.

我知道npm的工作比sbt好多了,我仍然可以把它放到我的包中…有什么不利的地方,我是否缺少关于sbt的东西?

解决方法

我赞同你.一旦应用程序开始对JavaScript库有不平凡的依赖,jsDependencies就不会扩展.这主要是因为WebJars缺少关键功能(就像传递性依赖)一样,而且因为jsDependencies不是一个被设计为扩展的机制.

随着时间的流逝,用户已经要求越来越多的jsDependencies的功能,因为他们希望将其用作真正的应用程序规模(无论什么意思)依赖机制.因此,我们已经在jsDependencies之上修补越来越多的功能/黑客.结果不是世界上最漂亮的事情,它绝对有缺点.

我实际上会鼓励使用Npm来解决你的依赖关系,特别是如果你熟悉它,并且知道如何将它集成到你的工作流中.

大佬总结

以上是大佬教程为你收集整理的node.js – 在ScalaJs sbt构建中,使用webjars而不是“提供”的npm或bower有什么优势吗?全部内容,希望文章能够帮你解决node.js – 在ScalaJs sbt构建中,使用webjars而不是“提供”的npm或bower有什么优势吗?所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。