I am trying to emulate my app in release mode, and it’s giving me an error I don’t quite understand:
C:\myApp>ionic cordova build android --prod --release
[INFO] Running app-scripts build: --prod --platform android --target cordova[19:34:29] build prod started …
[19:34:29] clean started …
[19:34:29] clean finished in less than 1 ms
[19:34:29] copy started …
[19:34:29] ngc started …
Error: Type AboutPage in C:/myApp/src/pages/about/about.ts is part of the declarations of 2 modules: AppModule in C:/myApp/src/app/app.module.ts and AboutPageModule in C:/myApp/src/pages/about/about.module.ts! Please consider moving AboutPage in C:/myApp/src/pages/about/about.ts to a higher module that imports AppModule in C:/myApp/src/app/app.module.ts and AboutPageModule in C:/myApp/src/pages/about/about.module.ts. You can also create a new NgModule that exports and includes AboutPage in C:/myApp/src/pages/about/about.ts then import that NgModule in AppModule in C:/myApp/src/app/app.module.ts and AboutPageModule in C:/myApp/src/pages/about/about.module.ts.
at syntaxError (C:\myApp\node_modules@angular\compiler\bundles\compiler.umd.js:1550:34)
at CompileMetadataResolver._addTypeToModule (C:\myApp\node_modules@angular\compiler\bundles\compiler.umd.js:14655:31)
at C:\myApp\node_modules@angular\compiler\bundles\compiler.umd.js:14543:27
at Array.forEach ()
at CompileMetadataResolver.getNgModuleMetadata (C:\myApp\node_modules@angular\compiler\bundles\compiler.umd.js:14534:54)
at addNgModule (C:\myApp\node_modules@angular\compiler\bundles\compiler.umd.js:23050:58)
at C:\myApp\node_modules@angular\compiler\bundles\compiler.umd.js:23061:14
at Array.forEach ()
at _createNgModules (C:\myApp\node_modules@angular\compiler\bundles\compiler.umd.js:23060:26)
at analyzeNgModules (C:\myApp\node_modules@angular\compiler\bundles\compiler.umd.js:22935:14)
here is app.module.ts –
import { BrowserModule } from ‘@angular/platform-browser’;
import { ErrorHandler, NgModule } from ‘@angular/core’;
import { IonicApp, IonicErrorHandler, IonicModule } from ‘ionic-angular’;import { MyApp } from ‘./app.component’;
import { HomePage } from ‘…/pages/home/home’;
import { TipsPage } from ‘…/pages/tips/tips’;
import { AboutPage } from ‘…/pages/about/about’;
import { SettingsPage } from ‘…/pages/settings/settings’;import { StatusBar } from ‘@ionic-native/status-bar’;
import { SplashScreen } from ‘@ionic-native/splash-screen’;
import { AdMobFree } from ‘@ionic-native/admob-free’;import { CourseDetailPage } from ‘…/pages/course-detail/course-detail’;
import { AddCoursePage } from ‘…/pages/add-course/add-course’;
import { Data } from ‘…/providers/data/data’;
import { IonicStorageModule } from ‘@ionic/storage/es2015’;@NgModule({
declarations: [
MyApp,
HomePage,
CourseDetailPage,
AddCoursePage,
TipsPage,
AboutPage,
SettingsPage
],
imports: [
BrowserModule,
IonicModule.forRoot(MyApp),
IonicStorageModule.forRoot()
],
bootstrap: [IonicApp],
entryComponents: [
MyApp,
HomePage,
CourseDetailPage,
AddCoursePage,
TipsPage,
AboutPage,
SettingsPage
],
providers: [
StatusBar,
SplashScreen,
AdMobFree,
{provide: ErrorHandler, useClass: IonicErrorHandler},
Data
]
})
export class AppModule {}
here is about.module.ts –
import { NgModule } from ‘@angular/core’;
import { IonicPageModule } from ‘ionic-angular’;
import { AboutPage } from ‘./about’;@NgModule({
declarations: [
AboutPage,
],
imports: [
IonicPageModule.forChild(AboutPage),
],
exports: [
AboutPage
]
})
export class AboutPageModule {}