Ionic 4 / Angular PWA production build is raising TypeError

I have an Ionic PWA application using Angular. It works perfectly fine locally but when I deploy it using the production option (ionic build –prod) it causes the error Uncaught TypeError: t is not a function.

Maybe there is a mismatch between dependencies but I am not sure how to troubleshoot this. There is no need in this project to keep a certain Angular version, I can try it with any Angular version beyond Angular 6. Does anybody has a suggestion to fix this?

Here is my local config:

Ionic:

   Ionic CLI                     : 6.1.0 (/home/mauricio/.nvm/versions/node/v12.13.0/lib/node_modules/@ionic/cli)
   Ionic Framework               : @ionic/angular 4.11.5
   @angular-devkit/build-angular : 0.801.3
   @angular-devkit/schematics    : 8.2.2
   @angular/cli                  : 8.2.2
   @ionic/angular-toolkit        : 2.1.1

Cordova:

   Cordova CLI       : 9.0.0 ([email protected])
   Cordova Platforms : none
   Cordova Plugins   : no whitelisted plugins (0 plugins total)

Utility:

   cordova-res : not installed
   native-run  : not installed

System:

   NodeJS : v12.13.0 (/home/mauricio/.nvm/versions/node/v12.13.0/bin/node)
   npm    : 6.12.0
   OS     : Linux 5.3

Here is the package json:

    {
      "name": "app-favor",
      "version": "0.0.1",
      "author": "Mauricio",
      "homepage": "https://ionicframework.com/",
      "scripts": {
        "ng": "ng",
        "start": "ng serve",
        "build": "ng build",
        "test": "ng test",
        "lint": "ng lint",
        "e2e": "ng e2e",
        "devapp": "ng run app:serve --host=0.0.0.0 --port=8100"
      },
      "private": true,
      "dependencies": {
        "@angular/animations": "^8.2.14",
        "@angular/cdk": "^8.2.3",
        "@angular/common": "~8.2.14",
        "@angular/core": "~8.2.14",
        "@angular/forms": "~8.2.14",
        "@angular/material": "^8.2.3",
        "@angular/platform-browser": "~8.2.14",
        "@angular/platform-browser-dynamic": "~8.2.14",
        "@angular/pwa": "^0.803.23",
        "@angular/router": "~8.2.14",
        "@angular/service-worker": "~8.2.14",
        "@ionic-native/core": "^5.0.0",
        "@ionic-native/http": "^5.17.1",
        "@ionic-native/splash-screen": "^5.0.0",
        "@ionic-native/status-bar": "^5.0.0",
        "@ionic/angular": "^4.7.1",
        "aws-amplify": "^2.2.6",
        "aws-amplify-angular": "^4.1.7",
        "cordova-android": "^8.1.0",
        "cordova-browser": "6.0.0",
        "cordova-plugin-file": "^6.0.2",
        "core-js": "^2.5.4",
        "rxjs": "~6.5.1",
        "tslib": "^1.9.0",
        "zone.js": "~0.9.1"
      },
      "devDependencies": {
        "@angular-devkit/architect": "~0.801.2",
        "@angular-devkit/build-angular": "~0.801.2",
        "@angular-devkit/core": "~8.2.2",
        "@angular-devkit/schematics": "~8.2.2",
        "@angular/cli": "~8.2.2",
        "@angular/compiler": "~8.2.14",
        "@angular/compiler-cli": "~8.2.14",
        "@angular/language-service": "~8.2.14",
        "@ionic/angular-toolkit": "^2.1.1",
        "@types/jasmine": "~3.3.8",
        "@types/jasminewd2": "~2.0.3",
        "@types/node": "~8.9.4",
        "codelyzer": "^5.0.0",
        "cordova-plugin-device": "^2.0.2",
        "cordova-plugin-ionic-keyboard": "^2.2.0",
        "cordova-plugin-ionic-webview": "^4.1.3",
        "cordova-plugin-splashscreen": "^5.0.2",
        "cordova-plugin-statusbar": "^2.4.2",
        "cordova-plugin-whitelist": "^1.3.3",
        "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.4.0",
        "protractor": "~5.4.0",
        "ts-node": "~7.0.0",
        "tslint": "~5.15.0",
        "typescript": "~3.4.3"
      },
      "description": "An Ionic project",
      "cordova": {
        "plugins": {
          "cordova-plugin-whitelist": {},
          "cordova-plugin-statusbar": {},
          "cordova-plugin-device": {},
          "cordova-plugin-splashscreen": {},
          "cordova-plugin-ionic-webview": {
            "ANDROID_SUPPORT_ANNOTATIONS_VERSION": "27.+"
          },
          "cordova-plugin-ionic-keyboard": {},
          "cordova-plugin-advanced-http": {
            "OKHTTP_VERSION": "3.10.0"
          },
          "cordova-onfido-sdk": {}
        },
        "platforms": [
          "android",
          "browser"
        ]
      }
    }

My ngsw-config.json:

{
  "$schema": "./node_modules/@angular/service-worker/config/schema.json",
  "index": "/index.html",
  "assetGroups": [
    {
      "name": "app",
      "installMode": "prefetch",
      "resources": {
        "files": [
          "/favicon.ico",
          "/index.html",
          "/*.css",
          "/*.js"
        ]
      }
    }, {
      "name": "assets",
      "installMode": "lazy",
      "updateMode": "prefetch",
      "resources": {
        "files": [
          "/assets/**",
          "/*.(eot|svg|cur|jpg|png|webp|gif|otf|ttf|woff|woff2|ani)"
        ]
      }
    }
  ]
}

Source: New feed
Source Url Ionic 4 / Angular PWA production build is raising TypeError