BurnsBA
BurnsBA

Reputation: 4939

LibMan without internet prevents build. Is there a local fallback option?

I have an aspnet core project (dotnet core 2.2). It uses the Microsoft.Web.LibraryManager.Build (1.0.172) package. If the network is down, the build fails with a bunch of similar errors:

Error LIB002 The "[email protected]" library could not be resolved by the "cdnjs" provider C.Web.App C:\Users\bburns\code\C.WEB.APP\libman.json 1

libman.json looks like

{
  "version": "1.0",
  "defaultProvider": "cdnjs",
  "libraries": [
    {
      "library": "[email protected]",
      "destination": "wwwroot/lib/jquery"
    },

    ...

Is there a way to specify an offline fallback when cdnjs is unavailable?

Upvotes: 3

Views: 2949

Answers (1)

user4864425
user4864425

Reputation:

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.

Upvotes: 1

Related Questions