logo
down
shadow

Ionic 3 iOS build --prod Not Working: Declarations of 2 Modules Error


Ionic 3 iOS build --prod Not Working: Declarations of 2 Modules Error

By : Gavin Biesheuvel
Date : November 21 2020, 03:00 PM
around this issue In my case, the solution was to delete the .module.ts (ngModule file) from each component and page folder generated by Ionic. Then, I made sure the components from my app were listed as declarations in my app.module.ts file. The app compiled perfectly in production.
Here is how my folder structure for a sample component or page looks like now:
code :
/examplecomponent
    /examplecomponent.html
    /examplecomponent.scss
    /examplecomponent.ts
import { ExampleComponent } from '../components/examplecomponent/examplecomponent';

@NgModule({
      declarations: [
            ExampleComponent
      ],
      imports: [
            IonicModule.forRoot(App),
            CloudModule.forRoot(cloudSettings),
            ElasticModule,
            BrowserModule,
            HttpModule
      ],
      bootstrap: [IonicApp],
      entryComponents: [
            MyApp,
            MainPage
      ],
      providers: [
            {provide: ErrorHandler, useClass: IonicErrorHandler},
            // All Injectable Classes Go Here
            Alert,
            Analytics,
            Auth,
            Background
      ]
})
export class AppModule {}


Share : facebook icon twitter icon
Ionic 2 : -- prod file not compiling Error: build prod failed: Cannot determine the module for class HomePage

Ionic 2 : -- prod file not compiling Error: build prod failed: Cannot determine the module for class HomePage


By : Francesco Abrusci
Date : March 29 2020, 07:55 AM
Hope that helps Found the Solution
As @Sébastien Mentioned to add the pages I did, but I'm not using the HomePage So I removed the page from the project. For latest Angular version the AOT compiler scans the whole project folder, so it is getting confused which classes are used and which are not. I added the files to declaration part after that it throws an error to add the template.
code :
@Component({
    selector: 'DbLoginService',
    template: '<span></span>'
})
Ionic build browser --prod --release showing error when I build for PWA

Ionic build browser --prod --release showing error when I build for PWA


By : Kristaps Kokins
Date : March 29 2020, 07:55 AM
I hope this helps . NVM. I finally figured out the solution by myself. By removing componetModule.ts . :p
Page is part of the declarations of 2 modules: Error in ionic build prod

Page is part of the declarations of 2 modules: Error in ionic build prod


By : Uzair Siddiqui
Date : March 29 2020, 07:55 AM
To fix the issue you can do This is a basic error of angular. You can see the issue here. So the answer that is accepted till now is use share module. You can do like this:
- Create a share.module.ts
ionic 4 - ionic cordova build android --prod doesn't copy angular environment.prod to environments

ionic 4 - ionic cordova build android --prod doesn't copy angular environment.prod to environments


By : BOUARFAOUI Saïd
Date : October 12 2020, 01:00 AM
hope this fix your issue I want to use the settings in enviroments.prod.ts to build my android production build with ionic 4. , Try this:
code :
ionic cordova build android --prod --release
** ionic build --prod ** is not working when i going to build for production

** ionic build --prod ** is not working when i going to build for production


By : FJ Hugs
Date : September 20 2020, 01:00 AM
With these it helps The error you are seeing above is not about the file size.
The error is due to duplicate declaration of the Page (Wrong Lazy Load config). You have the Pages as modules and have declared them both in app.module and in the Page's own module. You must declare them at only one place. (ArchivedConversationsPage)
shadow
Privacy Policy - Terms - Contact Us © voile276.org