Search code examples
javascriptvisual-studioasp.net-corewwwroot

Trying to import a third party library in Javascript - getting a 404


I have the a library referenced in my Asp.Net Core lib folder, under:

wwwroot/lib/vendor/product/dist/browser/library.js

I'm referencing that from my own JS module like this:

import { library } from '../lib/vendor/product/dist/browser/library';

The console error message tells me that this can't be found:

https://localhost:12345/lib/vendor/product/dist/browser/library (404)

When I look in sources, I can't find the library either - so it makes sense. My question is: why is this library not included in the sources? My understanding was that Visual Studio would do a local deploy, and anything inside wwwroot would get deployed to the local server; however, I assume this isn't happening, and that's why I'm getting the error.

As an aside, the library wasn't imported using npm, but copied manually into the lib folder; however, I've checked inside and outside VS, and the files are where they are supposed to be.


Solution

  • from your sample, the js extension is ommited. That might be the cause