Search code examples
angulartypescriptbuildangular7production

Why Angular Application throws error after Production Build?


I have an application whose development is complete. Now when I run the command ng build everything works smooth & fine. But when I run this command

ng build --prod --base-href /Incrency/

It shows the login page but when I login in it throws the following error.

ERROR Error: Uncaught (in promise): Error: No component factory found for t. 
Did you add it to @NgModule.entryComponents?
Error: No component factory found for t. Did you add it to @NgModule.entryComponents?

I am using Angular CLI : 7.3.2, Rxjs : 6.3.3 & Angular Core : 7.0.6


Solution

  • I have also faced the same issue, after trying all the steps on internet i finally figured out by removing the directive reference in html file which actually deleted, above error will not appear in ng build but if you try ng build --prod flag it will apear, so try checking directive actually exists before using it in Html, Hope this will solve your issue.