Error during executing "ionic cordova run android --prod"

I ran across “this issue” - meaning this web page. Here is my relevant info.

Here are the relevant parts:

package.json:

    "dependencies": {
        "@angular/animations": "4.1.3",
        "@angular/common": "4.1.3",
        "@angular/compiler": "4.1.3",
        "@angular/compiler-cli": "4.1.3",
        "@angular/core": "4.1.3",
        "@angular/forms": "4.1.3",
        "@angular/http": "4.1.3",
        "@angular/platform-browser": "4.1.3",
        "@angular/platform-browser-dynamic": "4.1.3",
        "@angular/platform-server": "4.1.3",
        "@angular/router": "4.1.3",
        "@angular/tsc-wrapped": "4.2.5",
        "@ionic-native/core": "4.1.0",
        "@ionic-native/keyboard": "4.1.0",
        "@ionic-native/network": "4.1.0",
        "@ionic-native/screen-orientation": "4.1.0",
        "@ionic-native/splash-screen": "4.1.0",
        "@ionic-native/status-bar": "4.1.0",
        "@ionic/storage": "2.0.1",
        "cordova": "7.0.1",
        "cordova-android": "6.2.3",
        "cordova-ios": "4.4.0",
        "cordova-plugin-compat": "1.1.0",
        "cordova-plugin-console": "1.0.7",
        "cordova-plugin-device": "1.1.6",
        "cordova-plugin-file": "4.3.3",
        "cordova-plugin-ios-disableshaketoedit": "1.0.0",
        "cordova-plugin-keyboard": "1.1.5",
        "cordova-plugin-network-information": "1.3.3",
        "cordova-plugin-privacyscreen": "0.3.1",
        "cordova-plugin-screen-orientation": "https://github.com/Exilz/cordova-plugin-screen-orientation",
        "cordova-plugin-splashscreen": "4.0.3",
        "cordova-plugin-statusbar": "2.2.3",
        "cordova-plugin-whitelist": "1.3.2",
        "cordova-plugin-wkwebview-engine": "https://github.com/driftyco/cordova-plugin-wkwebview-engine",
        "core-js": "2.4.1",
        "es6-promise-plugin": "4.1.0",
        "ionic": "3.6.0",
        "ionic-angular": "3.6.0",
        "ionic-plugin-keyboard": "2.2.1",
        "ionicons": "3.0.0",
        "rxjs": "5.4.2",
        "sw-toolbox": "3.6.0",
        "webpack": "3.1.0",
        "zone.js": "0.8.12"
    },
    "devDependencies": {
        "@ionic/app-scripts": "2.1.3",
        "@ionic/cli-plugin-cordova": "1.5.0",
        "@ionic/cli-plugin-ionic-angular": "1.4.0",
        "@ionic/cli-plugin-proxy": "1.4.0",
        "@types/angular": "1.6.25",
        "@types/ionic": "0.0.34",
        "@types/jasmine": "2.5.53",
        "@types/jest": "20.0.2",
        "@types/node": "6.0.60",
        "@types/sinon": "2.3.2",
        "codelyzer": "3.0.1",
        "fs": "0.0.1-security",
        "indexeddb-mock": "1.1.0",
        "jasmine-core": "2.6.2",
        "jasmine-spec-reporter": "4.1.0",
        "jest": "20.0.4",
        "jest-preset-angular": "2.0.4",
        "plist": "2.1.0",
        "protractor": "5.1.2",
        "rollup-plugin-replace": "1.1.1",
        "sinon": "2.3.5",
        "ts-node": "3.0.4",
        "tslint": "5.4.3",
        "typescript": "2.4.2"
    },
    "config": {
         "ionic_optimization": "./optimization.config.js",
        "ionic_webpack": "./webpack.config.js"
    }

optimization.config.js:

var path = require('path')
var webpack = require('webpack')
var ionicWebpackFactory = require(process.env.IONIC_WEBPACK_FACTORY)

module.exports = {
  entry: process.env.IONIC_APP_ENTRY_POINT,
  output: {
    path: '{{BUILD}}',
    publicPath: 'build/',
    filename: 'deptree.js'
  },

  resolve: {
    extensions: ['.js', '.ts', '.tsx'],
    modules: [path.resolve('node_modules'), path.resolve('src')],
    alias: {
      environments: path.resolve('src/environments'),
      app: path.resolve('src/app'),
      lib: path.resolve('src/lib'),
      pages: path.resolve('src/pages'),
      components: path.resolve('src/components'),
      validators: path.resolve('src/validators'),
      providers: path.resolve('src/providers'),
      models: path.resolve('src/models'),
      decorators: path.resolve('src/decorators'),
      pipes: path.resolve('src/pipes')
    }
  },

  module: {
    loaders: [
      {
        test: /\.tsx?$/,
        loader: process.env.IONIC_OPTIMIZATION_LOADER
      },
      {
        test: /\.js$/,
        loader: process.env.IONIC_OPTIMIZATION_LOADER
      }
    ]
  },

  plugins: [
    ionicWebpackFactory.getIonicOptimizationEnvironmentPlugin()
  ],

  // Some libraries import Node modules but don't use them in the browser.
  // Tell Webpack to provide empty mocks for them so importing them works.
  node: {
    fs: 'empty',
    net: 'empty',
    tls: 'empty'
  }
}

Ionic info:

cli packages:

    @ionic/cli-plugin-cordova       : 1.5.0
    @ionic/cli-plugin-ionic-angular : 1.4.0
    @ionic/cli-plugin-proxy         : 1.4.0
    @ionic/cli-utils                : 1.6.0
    ionic (Ionic CLI)               : 3.6.0

global packages:

    Cordova CLI : 7.0.1

local packages:

    @ionic/app-scripts : 2.1.3
    Cordova Platforms  : android 6.2.3 ios 4.4.0
    Ionic Framework    : ionic-angular 3.6.0

System:

    Android SDK Tools : 26.0.2
    Node              : v8.1.4
    OS                : macOS Sierra
    Xcode             : Xcode 8.3.3 Build version 8E3004b
    ios-deploy        : 1.9.1
    ios-sim           : 6.0.0
    npm               : 5.0.3

Command run:
ionic cordova build ios --prod --no-interactive

Error:

npm WARN invalid config loglevel="notice"

Running app-scripts build: --build --prod --iscordovaserve --externalIpRequired --nobrowser

[15:10:44]  build prod started ...
[15:10:44]  clean started ...
[15:10:44]  clean finished in 1 ms
[15:10:44]  copy started ...
[15:10:44]  ngc started ...
[15:11:01]  ngc finished in 16.92 s
[15:11:01]  preprocess started ...
[15:11:01]  deeplinks started ...
[15:11:03]  deeplinks finished in 2.22 s
[15:11:03]  optimization started ...
[15:11:27]  optimization finished in 23.28 s
[15:11:27]  preprocess finished in 25.50 s
[15:11:27]  webpack started ...
[15:13:46]  copy finished in 181.57 s
[WARN] Error occurred during command execution from a CLI plugin (@ionic/cli-plugin-cordova).
Error: ./node_modules/ionic-native/dist/esm/plugins/plugin.js
Module build failed: TypeError: Cannot read property 'type' of undefined
    at Object.getEffectiveTypeAnnotationNode (/xxx/node_modules/typescript/lib/typescript.js:9341:17)
    at assignContextualParameterTypes (/xxx/node_modules/typescript/lib/typescript.js:41652:25)
    at checkFunctionExpressionOrObjectLiteralMethod (/xxx/node_modules/typescript/lib/typescript.js:41948:29)
    at checkExpressionWorker (/xxx/node_modules/typescript/lib/typescript.js:42959:28)
    at checkExpression (/xxx/node_modules/typescript/lib/typescript.js:42898:42)
    at checkExpressionCached (/xxx/node_modules/typescript/lib/typescript.js:42779:38)
    at checkReturnStatement (/xxx/node_modules/typescript/lib/typescript.js:45418:54)
    at checkSourceElement (/xxx/node_modules/typescript/lib/typescript.js:46763:28)
    at Object.forEach (/xxx/node_modules/typescript/lib/typescript.js:1506:30)
    at checkBlock (/xxx/node_modules/typescript/lib/typescript.js:44563:16)
 @ ./node_modules/ionic-native/dist/esm/index.js 233:0-33
 @ ./node_modules/@ionic/cloud/dist/es5/di.js
 @ ./src/app/app.module.ngfactory.js
 @ ./src/app/main.ts
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! Foo@ build-ios-qa: `ionic cordova build ios --prod --no-interactive`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the Foo@ build-ios-qa script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

tsconfig.json:

{
  "compilerOptions": {
    "allowJs": true,
    "allowSyntheticDefaultImports": true,
    "baseUrl": "./src",
    "paths": {
      "environments/*": [
        "./environments/*"
      ],
      "app/*": [
        "./app/*"
      ],
      "lib/*": [
        "./lib/*"
      ],
      "pages/*": [
        "./pages/*"
      ],
      "components/*": [
        "./components/*"
      ],
      "validators/*": [
        "./validators/*"
      ],
      "providers/*": [
        "./providers/*"
      ],
      "models/*": [
        "./models/*"
      ],
      "decorators/*": [
        "./decorators/*"
      ],
      "pipes/*": [
        "./pipes/*"
      ]
    },
    "declaration": false,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "lib": [
      "dom",
      "es2015"
    ],
    "module": "es2015",
    "moduleResolution": "node",
    "noStrictGenericChecks": true,
    "removeComments": true,
    "sourceMap": true,
    "target": "es5",
    "typeRoots": [
      "node_modules/@types"
    ],
    "types": [
      "jasmine",
      "sinon"
    ]
  },
  "include": [
    "src/**/*.ts"
  ],
  "exclude": [
    "node_modules",
    "src/**/*.spec.ts"
  ],
  "compileOnSave": false,
  "atom": {
    "rewriteTsconfig": false
  }
}

webpack.config.js

var path = require('path')
var webpack = require('webpack')
var ionicWebpackFactory = require(process.env.IONIC_WEBPACK_FACTORY)

var ModuleConcatPlugin = require('webpack/lib/optimize/ModuleConcatenationPlugin')

var prodPlugins = []
if (process.env.IONIC_ENV === 'prod') {
  prodPlugins.push(new ModuleConcatPlugin())
}

var env = process.env.NODE_ENV || 'dev'

console.log('------------------------')
console.log('environment:', env)
console.log('------------------------')

module.exports = {
  entry: process.env.IONIC_APP_ENTRY_POINT,
  output: {
    path: '{{BUILD}}',
    publicPath: 'build/',
    filename: '[name].js',
    devtoolModuleFilenameTemplate: ionicWebpackFactory.getSourceMapperFunction(),
  },
  devtool: process.env.IONIC_SOURCE_MAP_TYPE,

  resolve: {
    extensions: ['.js', '.json', '.ts', '.tsx'],
    modules: [path.resolve('node_modules'), path.resolve('src')],
    alias: {
      environments: path.resolve('src/environments'),
      app: path.resolve('src/app'),
      lib: path.resolve('src/lib'),
      pages: path.resolve('src/pages'),
      components: path.resolve('src/components'),
      validators: path.resolve('src/validators'),
      providers: path.resolve('src/providers'),
      models: path.resolve('src/models'),
      decorators: path.resolve('src/decorators'),
      pipes: path.resolve('src/pipes')
    }
  },

  module: {
    loaders: [
      {
        test: /\.json$/,
        loader: 'json-loader'
      },
      {
        test: /\.tsx?$/,
        loader: process.env.IONIC_WEBPACK_LOADER
      },
      {
        test: /\.js$/,
        loader: process.env.IONIC_WEBPACK_TRANSPILE_LOADER
      }
    ]
  },

  plugins: [
    ionicWebpackFactory.getIonicEnvironmentPlugin(),
    ionicWebpackFactory.getCommonChunksPlugin(),
    new webpack.DefinePlugin({
      TA_ENV: {environment: JSON.stringify(env)}
    })
  ].concat(prodPlugins),

  // Some libraries import Node modules but don't use them in the browser.
  // Tell Webpack to provide empty mocks for them so importing them works.
  node: {
    fs: 'empty',
    net: 'empty',
    tls: 'empty'
  }
}