Prod build is not working getting below error

app.module.ts -

@NgModule({
  declarations: [
    MyApp, 
    AboutPage,
    ContactPage,
    HomePage,
    TabsPage,   
    DialerPage,
    AuthPage,
    LoginPage    
  ],
  imports: [
    BrowserAnimationsModule,
    HttpModule,
    BrowserModule,
    IonicModule.forRoot(MyApp),
    IonicImageViewerModule
  ],
  bootstrap: [IonicApp],
  entryComponents: [
    MyApp, 
    AboutPage,
    ContactPage,
    HomePage,
    TabsPage,   
    DialerPage,
    AuthPage,
    LoginPage
  ],
  providers: [
    FingerprintAIO,
    NativeStorage,
    Contacts,
    Camera,
    StatusBar,
    SplashScreen,
    {provide: ErrorHandler, useClass: IonicErrorHandler}
  ]
})

Running app-scripts build: --prod --platform android --target cordova
[15:44:25] build prod started …
[15:44:25] clean started …
[15:44:25] clean finished in 2 ms
[15:44:25] copy started …
[15:44:25] deeplinks started …
[15:44:26] deeplinks finished in 120 ms
[15:44:26] ngc started …
[15:44:32] typescript error
Cannot determine the module for class AboutPage in G:/MY_POC/V9/Talk/src/pages/about/about.ts! Add
AboutPage to the NgModule to fix it. Cannot determine the module for class ContactPage in
G:/MY_POC/V9/Talk/src/pages/contact/contact.ts! Add ContactPage to the NgModule to fix it. Cannot
determine the module for class HomePage in G:/MY_POC/V9/Talk/src/pages/home/home.ts! Add HomePage to
the NgModule to fix it. Cannot determine the module for class TabsPage in
G:/MY_POC/V9/Talk/src/pages/tabs/tabs.ts! Add TabsPage to the NgModule to fix it. Cannot determine the
module for class MyApp in G:/MY_POC/V9/Talk/src/app/app.component.ts! Add MyApp to the NgModule to fix
it. Cannot determine the module for class AppModule in G:/MY_POC/V9/Talk/src/app/app.module.ts! Add
AppModule to the NgModule to fix it.

Error: The Angular AoT build failed. See the issues above
at G:\MY_POC\V9\Talk\node_modules@ionic\app-scripts\dist\aot\aot-compiler.js:237:55
at step (G:\MY_POC\V9\Talk\node_modules@ionic\app-scripts\dist\aot\aot-compiler.js:32:23)
at Object.next (G:\MY_POC\V9\Talk\node_modules@ionic\app-scripts\dist\aot\aot-compiler.js:13:53)
at fulfilled (G:\MY_POC\V9\Talk\node_modules@ionic\app-scripts\dist\aot\aot-compiler.js:4:58)
at
[15:44:32] copy finished in 6.84 s

You are not using lazy loading right?

Have you maybe an annotation @IonicPage() in your about.ts, contact.ts, home.ts, tabs.ts etc.? Maybe try to remove them

@reedrichards - There was one, have removed it, still same issue. I m using below command.

ionic cordova run android --prod --release

Have you maybe some remaining page.module.ts (like about.module.ts) files?

If you are not using lazy loading, delete them (except of course app.module.ts)

1 Like