[英]LibMan without internet prevents build. Is there a local fallback option?
I have an aspnet core project (dotnet core 2.2). 我有一个aspnet核心项目(dotnet核心2.2)。 It uses the
Microsoft.Web.LibraryManager.Build (1.0.172)
package. 它使用
Microsoft.Web.LibraryManager.Build (1.0.172)
包。 If the network is down, the build fails with a bunch of similar errors: 如果网络中断,构建将失败,并出现许多类似的错误:
Error LIB002 The "toastr.js@2.1.4" library could not be resolved by the "cdnjs" provider C.Web.App C:\\Users\\bburns\\code\\C.WEB.APP\\libman.json 1
错误LIB002“ cdnjs”提供程序C.Web.App C:\\ Users \\ bburns \\ code \\ C.WEB.APP \\ libman.json 1无法解析“ toastr.js@2.1.4”库
libman.json
looks like libman.json
看起来像
{
"version": "1.0",
"defaultProvider": "cdnjs",
"libraries": [
{
"library": "jquery@3.3.1",
"destination": "wwwroot/lib/jquery"
},
...
Is there a way to specify an offline fallback when cdnjs
is unavailable? 当
cdnjs
不可用时,是否可以指定脱机回退?
You can save the libs in a local or shared location and reference that in your projects, as in this example of the documentation : 您可以将这些库保存在本地或共享位置,并在您的项目中引用它们,如本文档的示例所示:
{
"provider": "filesystem",
"library": "C:\\temp\\lodash\\",
"files": [
"lodash.js",
"lodash.min.js"
],
Where library may be a relative path as well. 库也可能是相对路径。
The drawback is that updates are not detected from the project, so you'll have to think of a strategy on how to keep the libraries up-to-date. 缺点是无法从项目中检测到更新,因此您必须考虑如何使库保持最新的策略。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.