Search code examples
c#asp.net-mvcangularangular-elementsasp.net-bundling

C# MVC bundling not working with Angular Elements Web Component


I'm using Angular Elements in C# MVC project.

When I include angular elements build file directly in main.cshtml like <script type="text/javascript" src="~/Script/Angular/artifi-graphics.js"></script> it's working perfectly.

BUT

when I try to add build file in the bundle

bundles.Add(new ScriptBundle("~/bundles/Layout_8_CommonModule")
                .Include("~/Script/Angular/artifigraphics.js")

then the project is not loading.

In console network status of the request is pending and after some time it gets failed. enter image description here


Solution

  • after searching a lot find out C# bundling is not so intelligent to bundle angular production build files which are also merged by node concat library.

    so I just added angular bundle into main.cshtml file just like we add scripts.