Ionic 3 page includes give error when build making using --prod flag


#1

I am confused in ionic 3. when i fire command of generate page using ionic g page Contact they generate page inside pages folder. This folder contains 4 files. I am confused in .module file. In some example i cannot see .module and here this file is generate using ionic command so if this file is generated we dont have to include pages in app.module.ts file? if i remove they gives and after including pages that is working but ionic build android --prod command give error like

Error: Type SettingsPage in E:/paresh/ionic-v3/todo/src/pages/settings/settings.ts is part of the 
declarations of 2 modules: AppModule in E:/paresh/io
nic-v3/todo/src/app/app.module.ts and SettingsPageModule in E:/paresh/ionic-
v3/todo/src/pages/settings/settings.module.ts! Please consider moving Sett
ingsPage in E:/paresh/ionic-v3/todo/src/pages/settings/settings.ts to a higher module that imports   
AppModule in E:/paresh/ionic-v3/todo/src/app/app.mo
dule.ts and SettingsPageModule in E:/paresh/ionic-v3/todo/src/pages/settings/settings.module.ts. You 
can also create a new NgModule that exports and i
ncludes SettingsPage in E:/paresh/ionic-v3/todo/src/pages/settings/settings.ts then import that 
NgModule in AppModule in E:/paresh/ionic-v3/todo/src/a
pp/app.module.ts and SettingsPageModule in E:/paresh/ionic-
v3/todo/src/pages/settings/settings.module.ts.

Note: ionic build android command work and apk also working file. just --prod cause issue. Please help .

Thanks


#2

Yes, me too. Any explanation? Any help, please?


#3

I suggest forgetting that the generators exist. Make things yourself.


#4

Yah sure. So i have to create how many files for each page? 3? .ts, .scss and .html only?


#5

ts and html only are sufficient in many cases. scss is only needed if you have specific styling needs for that page. module.ts is only needed if you are using lazy page loading, and if you’re not sure whether you want to do that, you probably don’t.


#6

Yes are right. I remove module file and remove ionicPage() after --prod is working. Thanks