How to fix Ionic –prod Error: Module not found: module.ngfactory

/ December 18, 2017/ Ionic

(Last Updated On: February 12, 2018) Jeez this error title is long! And it should be Ionic --prod Error: ./src/app/main.ts Module not found: Error: Can't resolve './app.module.ngfactory' in src/app

For the time being I really like to work with Angular (version 5 now) and Ionic but as I am not fanboy I can see their flaws. One of them is the way the errors are reported when we use the --prod flag.

Ad:


A common and kind of obvious cause of this error is a .module.ts file that can not be correctly imported, maybe the path is wrong or the module or the module is not imported in a lazy load page (or it is imported/declared two times).

A not so obvious and hard to find error if you do not know where to look is having a .module.ts for a page or component that is not used with lazy load. I Honestly don’t quite know which Angular AoT rule this breaks (AoT if used with the --prod flag) but if you have a component that does not need lazy load remove that file or rename it in other way.

Ad:


Spread the love
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments