Error while building --prod Version ionic 3

hi,
I am trying to build my ionic project for android only for now . when i run

ionic cordova build --release android

it builds successfully. But when i use --prod flag for production build it is throwing error

Error: Cannot determine the module for class OverlayPortal in D:/capacitor_ionic/ionic/node_modules/ionic-angular/umd/components/app/overlay-portal.d.ts! Add OverlayPortal to the NgModule to fix it.
Cannot determine the module for class IonicApp in D:/capacitor_ionic/ionic/node_modules/ionic-angular/umd/components/app/app-root.d.ts! Add IonicApp to the NgModule to fix it.
Cannot determine the module for class ClickBlock in D:/capacitor_ionic/ionic/node_modules/ionic-angular/umd/components/app/click-block.d.ts! Add ClickBlock to the NgModule to fix it.
Cannot determine the module for class Slides in D:/capacitor_ionic/ionic/node_modules/ionic-angular/umd/components/slides/slides.d.ts! Add Slides to the NgModule to fix it.

i dont know how to fix it . so if anyone knows then it would be a great help

I think the problem was also discussed here!

When use ionic cordova build android --prod im face this below errorrs

HOW TO SOLVE THIS ISSUE PLEASE HELP ME

[19:34:46] ionic-app-script task: “build”
[19:34:46] Error: The Angular AoT build failed. See the issues above
Error: The Angular AoT build failed. See the issues above
at /Users/karuppasamy/sites/product_mobile/inncommops_mobile/node_modules/@ionic/app-scripts/dist/aot/aot-compiler.js:237:55
at step (/Users/karuppasamy/sites/product_mobile/inncommops_mobile/node_modules/@ionic/app-scripts/dist/aot/aot-compiler.js:32:23)
at Object.next (/Users/karuppasamy/sites/product_mobile/inncommops_mobile/node_modules/@ionic/app-scripts/dist/aot/aot-compiler.js:13:53)
at fulfilled (/Users/karuppasamy/sites/product_mobile/inncommops_mobile/node_modules/@ionic/app-scripts/dist/aot/aot-compiler.js:4:58)
at
[ERROR] An error occurred while running subprocess ionic-app-scripts.

Best way to resolve it to start learning flutter!

  • a frustrated ionic developer
1 Like

i solve my problem. in my project i was using an outdated module, ion-datepicker
if you are also using same issue, here are some steps, you can follow and find your infected or outdated module.

  1. Step one:

in your project find in all files
from 'ionic-angular/
word,

  1. Step Two:

if you find this word like
import { xyz } from 'ionic-angular/xyz/abc'

update that module.

if no update available then you can remove that module

npm uninstall ion-datepicker(or your defected module)

after this you needs to remove that module from app.module.ts and where ever you are using remove from there, after that you can try

ionic cordova build android --prod --release

hope this will help.
Thanks

It’s working for me forcing to use typescript 2.7.2

“devDependencies”: {
@ionic/app-scripts”: “3.2.3”,
@types/core-js”: “2.5.0”,
“typescript”: “2.7.2”,
“ws”: “3.3.2”
},

you have some module added in your project but you have used it. check the app.Module, see if you have imported all the modules which is in your project.

here is a fix that worked for me.

in app.module.ts, add this:

import { OverlayPortal } from 'ionic-angular/components/app/overlay-portal';
import { ClickBlock } from 'ionic-angular/components/app/click-block';
import {IonicApp as IonicAppRoot} from 'ionic-angular/components/app/app-root';

...


declarations: [
    ...

    OverlayPortal,
    IonicAppRoot,
    ClickBlock,
  ],