No output when --prod is applied?

I am upgrading a PWA app from ionic 4/Angular 8 to Ionic 5/Angular 9.
Since the upgrade I have problems when I do a “ionic build --prod” command, before it was working fine, also with “–prod”.

Following lines gives an output in “ionic build” mode correctly, but gives no output with “ionic build --prod” (there is no output read at all/stays empty but should log on input):

console.log('output barcode2 : ', this.rows.at(idx).value.barcode2)

I think it is ionic related and not angular, but I’m not sure. Anyway, I can not seem to find why the “–prod” flag produces this issue. Can someone inform me ?

Thanks

html:

<div [formGroup]="timeform" novalidate align="center">
<ion-grid>
  <ion-row *ngFor="let row of timeform.get('rows')?.controls; let idx = index;" class="ion-justify-content-center">
     <ion-col>
        <ion-row>
         <ion-col size="10">
           <ion-input pattern="[0-9]*" inputmode="decimal" [formControl]="row.get('barcode2')"
            formControlName="barcode2" placeholder="..." #Field2 (ionChange)="findActivity(idx)" 
            (keydown)="isValidNumber($event)"></ion-input>
      ...
     </ion-col>
    </ion-row>
   </ion-col>
  </ion-row>
</ion-grid>
</div>

ts

findActivity(idx) {
      console.log('index    : ', idx)
      console.log('barcode2 : ', this.rows.at(idx).value)
      console.log('barcode2 : ', this.rows.at(idx).value.barcode2)
      console.log('barcode2 : ', this.rows.at(idx).get('barcode2').value)
  }

package.json

{
  "name": "app",
  "version": "0.0.1",
  "author": "Ionic Framework",
  "homepage": "https://ionicframework.com/",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "^9.1.11",
    "@angular/common": "~9.1.11",
    "@angular/core": "~9.1.11",
    "@angular/forms": "~9.1.11",
    "@angular/platform-browser": "~9.1.11",
    "@angular/platform-browser-dynamic": "~9.1.11",
    "@angular/pwa": "^0.803.28",
    "@angular/router": "~9.1.11",
    "@angular/service-worker": "~9.1.11",
    "@ionic-native/core": "^5.27.0",
    "@ionic-native/splash-screen": "^5.27.0",
    "@ionic-native/status-bar": "^5.27.0",
    "@ionic/angular": "^5.2.3",
    "core-js": "^2.5.4",
    "date-fns": "^2.14.0",
    "idb": "^4.0.5",
    "rxjs": "~6.5.5",
    "tslib": "^1.13.0",
    "zone.js": "~0.10.3"
  },
  "devDependencies": {
    "@angular-devkit/architect": "~0.801.2",
    "@angular-devkit/build-angular": "^0.901.10",
    "@angular-devkit/core": "^9.1.10",
    "@angular-devkit/schematics": "^9.1.10",
    "@angular/cli": "^9.1.10",
    "@angular/compiler": "~9.1.11",
    "@angular/compiler-cli": "~9.1.11",
    "@angular/language-service": "~9.1.11",
    "@ionic/angular-toolkit": "^2.2.0",
    "@types/jasmine": "~3.3.8",
    "@types/jasminewd2": "~2.0.3",
    "@types/node": "~8.9.4",
    "codelyzer": "^5.2.2",
    "jasmine-core": "~3.4.0",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "~4.1.0",
    "karma-chrome-launcher": "~2.2.0",
    "karma-coverage-istanbul-reporter": "~2.0.1",
    "karma-jasmine": "~2.0.1",
    "karma-jasmine-html-reporter": "^1.5.4",
    "protractor": "^5.4.4",
    "ts-node": "~7.0.0",
    "tslint": "~5.15.0",
    "typescript": "~3.8.3"
  },
  "description": "An Ionic project"
}

That happened to me too but the error was something related to my code that wasn’t caught by Angular or Javascript. (It’s been two years so I don’t remember exactly what was the issue)

My recommendation would be to debug your app from start up to where the user gets control of the app for logical errors.

Hmm it seems you are right, some error is not picked up by the compiler after the update.
Re-organizing the dynamic grid/form solves the problem.

Thanks for letting me know where to look :+1:

1 Like