Node_modules not part of wwwroot :-Lesson learnt while taking ASP.NET MVC core training in Mumbai Institute.

In today’s evening ASP.NET MVC training in Mumbai Andheri we faced a typical issue with wwwroot folder. If you see in new ASP.NET core all HTML, CSS and Javascript files are stored in wwwroot.

If you are using Angular 2 then you come with that huge folder of node_modules which is almost like 30 MB. Sad part is ASP.NET core only identifies javascript files which are under wwwroot anything outside that it does not identify.

So if you wish to use your javascript files in node_modules you need to include the below code in startup.cs file.

var options = newFileServerOptions();
options.RequestPath = "/node_modules";
options.StaticFileOptions.FileProvider = provider;
options.EnableDirectoryBrowsing = true;
app.UseFileServer(options);

Do not miss our next ASP.NET MVC batch coming week in Mumbai

http://stepbystepschools.net/?page_id=315

Comments

comments

This entry was posted in ASP.NET MVC Training, Class Room Training, MVC, MVC Training in Mumbai and tagged , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published.