I am received a error when i use build --prod
Error
I already try import ChatItemModule and remove ChatItem of declarations, but the new error occour:
someone know shomething about this ?
I am received a error when i use build --prod
Error
I already try import ChatItemModule and remove ChatItem of declarations, but the new error occour:
someone know shomething about this ?
A post was split to a new topic: Error encountered resolving symbol values statically
did you have item.module.ts file?
You cannot declare any component in more than one single ngModule.
The solution for your first error is as follows:
Declare the āChatItemā component in either AppModule or ChatItemModule, but not in both of them.
I had same error - remove ChatModule from @NgModules - declarations. Keep only in imports.
I run into the same issue, and I resolved itā¦
But keep in mind that in order to create my Component, I run from command-line:
ionic g component MyComponent
So the command-line generator probably does do the job correctly, and misleading the developer.
Is this a bug?
Regards
Costas
What did you do additionally to ionic g component
?
If nothing, then this is definitely a bug that should be reported at https://github.com/ionic-team/ionic-cli/issues
Yes but when you run ionic serve
the following error appear:
Component is not part of any NgModule or the module has not been imported into your module. ; Zone: <root> ; Task: Promise.then ; Value: Error: Component ContratistasLista is not part of any NgModule or the module has not been imported into your module.
I think this should solve your problem.
I solved my from this!
infolder ChatItem
1.delete chatitem.module.ts
2.in chatitem.ts delete import{ Ionicpage } from āionic-angularā;
3.in chatitem.ts delete @Ionicpage()
4.in terminal >ionic cordova build android --prod OR ionic cordova build ios --prod
Thanks @monoko26333 and @arnoldparge
This solve the issue!!!
This made the trick!
I think we should do in ionic way / angular for Page instead deleting, you could do this:
@NgModule({
declarations: [SomePage],
imports: [IonicPageModule.forChild(SomePage)],
exports: [SomePage],
entryComponents: [SomePage]
})
@NgModule({
imports: [
ā¦
SomePageModule,
ā¦
Donāt know why ionic-cli not added this when generate page.
Sadly, whenever generating page, iām always redo this
This is how i fixed it:
imports: [ ... ]
in app.module.ts
.entryComponents: [..]
in app.module.ts
.mypage.module.ts
files.**
imports: [ ... ]
in app.module.ts
.Hereās a full example of my app.module.ts
:
import { NgModule, ErrorHandler } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { IonicApp, IonicModule, IonicErrorHandler } from 'ionic-angular';
import { HttpModule } from '@angular/http';
import { IonicStorageModule } from '@ionic/storage';
import { MyApp } from './app.component';
import { StatusBar } from '@ionic-native/status-bar';
import { SplashScreen } from '@ionic-native/splash-screen';
import { PlanProvider } from '../providers/plan/plan';
import { ExerciseProvider } from '../providers/exercise/exercise';
import { TabsPageModule } from '../pages/tabs/tabs.module';
import { TrainingPageModule } from '../pages/training/training.module';
import { PlansPageModule } from '../pages/plans/plans.module';
import { CloudPageModule } from '../pages/cloud/cloud.module';
import { CreatePlanPageModule } from '../pages/create-plan/create-plan.module';
@NgModule({
declarations: [
MyApp
],
imports: [
BrowserModule,
IonicModule.forRoot(MyApp),
IonicStorageModule.forRoot(),
HttpModule,
TabsPageModule,
TrainingPageModule,
PlansPageModule,
CloudPageModule,
CreatePlanPageModule
],
bootstrap: [IonicApp],
entryComponents: [
MyApp
],
providers: [
StatusBar,
SplashScreen,
{provide: ErrorHandler, useClass: IonicErrorHandler},
IonicStorageModule,
PlanProvider,
ExerciseProvider
]
})
export class AppModule {}
Generate a page creates a module for lazy-loaded pages in ionic3
If you donāt want to take advantage of lazy loading use
$ ionic generate [type] [name] --no-module // Do not generate an NgModule for the component
As far as I know @altergothen is right. The page-name.module.ts
file and @IonicPage
decorator are used for lazy loading and if you want to take advantage of it you should keep both of them.
You can learn more about Lazy Loading with Ionic in this article from the official blog - https://blog.ionicframework.com/ionic-and-lazy-loading-pt-1/
I think the point of Lazy Loading is not to declare these pages in app.module.ts
in any form. They will be loaded on demand the first time you need them. You have to change all occurrences of the page to strings and Ionic will handle the rest. In the blog post mentioned above there are links to example projects where you can see how it should be.
YES, Si eliminado loe Module.ts and eliminado @IonicPage() ā¦ Todo OK
Thanks, It works now.
But why the cli create this component.module.ts if we have to delete it in order to build without error ?
Thank you!!! This worked for me and it saved me a lot of time!!!
Dear Friends,
Donāt avoid lazy loading its an advanced feature of ionic 3 to make the performance better .
In Your app.module.ts you do only two editing for a page
Suppose your new page module is āBuidingStatusPageModuleā
then
import same as normal
import { BuildingStatusPageModule } from āā¦/pages/building-status/building-status.moduleā;
then add
imports: [
BuildingStatusPageModule,
Done . Your problem will solveā¦
Try it and enjoy.
Thanks
Anes