Open Zerokk opened 3 years ago
Bump.
A little update:
I fixed the "normal" errors, such as a component property not being public, a property not existing... those are fixed now, but I still have template errors in the file app.component.html
, like if Ionic wasn't added to the module (but yes, it's added in every module, in the main one with the .forRoot()
method.
There's another weird error in which Angular asks me for a string as parameter to the "limitTo" pipe. The documentation says it needs an integer, and that's what I'm doing, and what works in my app. Why is it finding this as an error?
Please, this is quite urgent, and the app is slow in the dev version. I need the production build ready soon...
Also tried reupdating the ionic-cli, creating a new project, moving the code and re-compiling it, aswell adding the CUSTOM_ELEMENTS_SCHEMA
in NgModule.schemas. Nothing works.
This is how my main module looks. The comments are parts of the code that are now removed for the beta version:
@NgModule({
declarations: [
AppComponent,
],
imports: [
BrowserModule,
IonicModule.forRoot(),
AppRoutingModule,
ComponentsModule,
FormsModule,
// AssistanceCheckerModule,
// ServiceWorkerModule.register('/ngsw-worker.js', { enabled: environment.production })
],
providers: [
ParseHandlerService,
StatusBar,
Geolocation,
SplashScreen,
AppStateService,
SpinnerService,
IconGetterService,
ReactiveChannel,
// DatePicker,
ImageResizer
],
bootstrap: [AppComponent]
})
export class AppModule { }
EDIT: yes, all the modules have the IonicModule
imported, including the ComponentsModule
one.
Having the same problem, any updates on this?
I encountered this problem several times - randomly - usually after generating a new component, however the previous -prod builds were successful. Probably it is a build-bug since it happens once in a while :wink:
You probably are trying to open your component/page in a modal window.
If yes: Add YourCustomComponentModule to the imports list of the ParentModule and your problem will disappear :slight_smile:
parent.module.ts → … [ CommonModule, FormsModule, IonicModule, YourCustomComponentModule ] …
Cheers!
@shandree By the gods!! That was the answer!! I was trying to open my component in a modal window and hadn't imported the child module into the parent module. Thank you so much!! I would never have figured this out on my own
I encountered this problem several times - randomly - usually after generating a new component, however the previous -prod builds were successful. Probably it is a build-bug since it happens once in a while 😉
You probably are trying to open your component/page in a modal window.
If yes: Add YourCustomComponentModule to the imports list of the ParentModule and your problem will disappear :slight_smile:
parent.module.ts → … [ CommonModule, FormsModule, IonicModule, YourCustomComponentModule ] …
Cheers!
Thanks , this worked for me too .
importing IonicModule (without .forRoot()) worked for me... only in app.module I have .forRoot() all the other modules just IonicModule. FYI I am having a modal and it works. Cheers!
I had also these errors. All the errors was related to the ionic componenents but only those used in one of my components. The reason was, i forgot to declare my component in "declarations" array of my module. Hope it helps.
In AppModule.forRoot() and all others without worked for me too.
Glad to bump into this topic, thanks and see ya around o/
I solve it another way. After wasting a lot of time trying to solve it, I went to the 'mycomponent.component.ts' file and imported IonicModule from '@ionic/angular'. In @component I added the following lines: standalone: true, imports: [IonicModule]
Description: I have an Ionic app that is already almost done. Until now, I've been testing it with the regular
ionic build
method, and then using Capacitor to make an APK to test. That works well, just as the app does in the navigator, when developing it.But when I try to use the
--prod
flag to optimize my code, I receive a huge amount of template errors that don't allow me to compile the code. Needless to say, these errors never show up on regular builds.Steps to Reproduce: Having a normally working version (both for Android and web), try to build a production version with
ionic build --prod
.Output: Here you have my output. You can see it mainly affects the templates:
My
ionic info
:`Ionic:
Ionic CLI : 6.11.1 (C:\Users\zerok\AppData\Roaming\npm\node_modules\@ionic\cli) Ionic Framework : @ionic/angular 5.5.4 @angular-devkit/build-angular : 0.1101.4 @angular-devkit/schematics : 9.1.9 @angular/cli : 11.1.4 @ionic/angular-toolkit : 2.2.0
Capacitor:
Capacitor CLI : 2.4.6 @capacitor/core : 2.4.6
Utility:
cordova-res : not installed native-run : not installed
System:
NodeJS : v15.7.0 (C:\Program Files\nodejs\node.exe) npm : 6.14.11 OS : Windows 10`