Tried ionic cordova build android --prod --release
in an attempt to prepare an app for deployment.
I came across an error which I attempted to fix.
The error originally received was
Type SecondPage in longlocation/second/second.ts is part of the declarations of 2 modules: AppModule in longlocation/src/app/app.module.ts and SecondPageModule in longlocation/src/pages/second/second.module.ts! Please consider moving SecondPage in longlocation/src/pages/second/second.ts to a higher module that imports AppModule in longlocation/src/app/app.module.ts and SecondPageModule in longlocation/src/pages/second/second.module.ts.
I removed the mentioned components from
declarations
as instructed by another stackoverflow answer.
Now I'm getting another error which says
unexpected directive 'SecondPage' imported by the module 'AppModule'. Please add a @ngmodule annotation
My code is
import { BrowserModule } from '@angular/platform-browser';
import { ErrorHandler, NgModule } from '@angular/core';
import { IonicApp, IonicErrorHandler, IonicModule } from 'ionic-angular';
import { SplashScreen } from '@ionic-native/splash-screen';
import { StatusBar } from '@ionic-native/status-bar';
import { MyApp } from './app.component';
import { HomePage } from '../pages/home/home';
import { SecondPage } from '../pages/second/second';
import { SendtextPage } from '../pages/sendtext/sendtext';
import { SMS } from '@ionic-native/sms';
import { HttpClientModule } from '@angular/common/http';
@NgModule({
declarations: [
MyApp,
HomePage,
//SecondPage,
//SendtextPage
],
imports: [
BrowserModule,
HttpClientModule,
SecondPage,
SendtextPage,
IonicModule.forRoot(MyApp)
],
bootstrap: [IonicApp],
entryComponents: [
MyApp,
HomePage,
SecondPage,
SendtextPage
],
providers: [
StatusBar,
SplashScreen,
SMS,
{provide: ErrorHandler, useClass: IonicErrorHandler}
]
})
export class AppModule {}
Ionic Framework : 3.9.2 Ionic App Scripts : 3.2.1 Angular Core : 5.2.11 Angular Compiler CLI : 5.2.11 Node : 10.6.0
Any help is greatly appreciated.
declarations
andentryComponents
– Abdulrahman Falyounimports
array in your app module? Only modules should be declared there. – R. Richardsdeclarations
andentryComponents
– Abdulrahman Falyoun