I have developed one app in Ionic and while I try to deploy my app with --prod its throwing below error and without --prod its working fine.
Command : sudo ionic cordova build ios --release --prod
Error :
Error: ./src/app/main.ts
Module not found: Error: Can't resolve './app.module.ngfactory' in '/Volumes/DATA/Dhanesh/Projects/FA app/TestNewCordova/failure_analysis_app/Ionic/src/app' resolve './app.module.ngfactory' in '/Volumes/DATA/Dhanesh/Projects/FA app/TestNewCordova/failure_analysis_app/Ionic/src/app' using description file: /Volumes/DATA/Dhanesh/Projects/FA app/TestNewCordova/failure_analysis_app/Ionic/package.json (relative path: ./src/app) Field 'browser' doesn't contain a valid alias configuration after using description file: /Volumes/DATA/Dhanesh/Projects/FA app/TestNewCordova/failure_analysis_app/Ionic/package.json (relative path: ./src/app) using description file: /Volumes/DATA/Dhanesh/Projects/FA app/TestNewCordova/failure_analysis_app/Ionic/package.json (relative path: ./src/app/app.module.ngfactory) no extension
While if I remove --prod and just run sudo ionic cordova build ios --release
and without fail it build successfully.
I found many solution for above error but still didn't got any luck to come out from this error.
Ref I tried so far :
Try to find error in
$ ./node_modules/.bin/ngcbut there is no error log over there.Some post on github also not working https://github.com/angular/angular-cli/issues/8858
Help me if nay one solved same problem with ionic build ios.
Thanks in advance!
Edit :
main.ts
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { AppModule } from './app.module';
import { enableProdMode } from '@angular/core';
enableProdMode();
platformBrowserDynamic().bootstrapModule(AppModule);