Jignesh Mistry
Jignesh Mistry

Reputation: 2479

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

Upvotes: 1

Views: 3209

Answers (2)

pradip shinde
pradip shinde

Reputation: 586

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.

Upvotes: 3

Suresh Kumar Ariya
Suresh Kumar Ariya

Reputation: 9754

Issue might be, some components is getting used in your application which is not declared in NgModule. It should be added as the entryComponents, otherwise angular can't able to identify and compile it during build time.

Upvotes: 1

Related Questions