"ionic cordova build --prod" does not run in Xcode 10 iOS simulator or Android device

#1

Building ionic app with --prod will not run in Xcode 10 iOS simulator or Android device.
The app hangs at the splash page.
$ ionic cordova build [ios|android] --prod

App runs ok without --prod

Xcode console:

libMobileGestalt MobileGestalt.c:890: MGIsDeviceOneOfType is not supported on this platform.
Apache Cordova native platform version 4.5.5 is starting.
Multi-tasking -> Device: YES, App: YES
CDVWKWebViewEngine: trying to inject XHR polyfill
CDVWKWebViewEngine will reload WKWebView if required on resume
Using Ionic WKWebView
[CDVTimer][console] 0.082016ms
[CDVTimer][handleopenurl] 0.109911ms
[CDVTimer][intentandnavigationfilter] 1.754045ms
[CDVTimer][gesturehandler] 0.052094ms
[CDVTimer][file] 1.561999ms
CDVIonicKeyboard: resize mode 1
[CDVTimer][keyboard] 1.948953ms
[CDVTimer][splashscreen] 5.697966ms
[CDVTimer][statusbar] 4.747987ms
[CDVTimer][socialsharing] 0.107050ms
[CDVTimer][TotalPluginStartup] 17.371058ms
Ionic Native: deviceready event fired after 720 ms

Terminal output:

$ ionic cordova build ios --prod
> ionic-app-scripts build --prod --target cordova --platform ios
[20:27:38]  ionic-app-scripts 3.2.1 
[20:27:38]  build prod started ... 
[20:27:38]  clean started ... 
[20:27:38]  clean finished in 20 ms 
[20:27:38]  copy started ... 
[20:27:39]  deeplinks started ... 
[20:27:39]  deeplinks finished in 498 ms 
[20:27:39]  ngc started ... 
[20:27:57]  ngc finished in 18.42 s 
[20:27:57]  preprocess started ... 
[20:27:57]  preprocess finished in less than 1 ms 
[20:27:57]  webpack started ... 
[20:27:58]  copy finished in 20.08 s 
[20:30:20]  webpack finished in 142.73 s 
[20:30:20]  uglify started ... 
[20:30:20]  sass started ... 
[20:30:24]  sass finished in 3.34 s 
[20:30:24]  cleancss started ... 
[20:30:26]  cleancss finished in 2.11 s 
[20:31:24]  uglify finished in 64.22 s 
[20:31:24]  postprocess started ... 
[20:31:24]  postprocess finished in 44 ms 
[20:31:24]  lint started ... 
[20:31:24]  build prod finished in 226.37 s 
no-unused-variable is deprecated. Since TypeScript 2.9. Please use the built-in compiler checks instead.
[20:31:30]  lint finished in 5.51 s 
> cordova build ios
Reading build config file:
Building for iPhone X Simulator
Building project: /Users/ddev/project/ionic/application/platforms/ios/myApp.xcworkspace
	Configuration: Debug
	Platform: emulator
Build settings from command line:
    CONFIGURATION_BUILD_DIR = /Users/ddev/project/ionic/application/platforms/ios/build/emulator
    SDKROOT = iphonesimulator12.1
    SHARED_PRECOMPS_DIR = /Users/ddev/project/ionic/application/platforms/ios/build/sharedpch

Build settings from configuration file '/Users/ddev/project/ionic/application/platforms/ios/cordova/build-debug.xcconfig':
    CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = YES
    CODE_SIGN_ENTITLEMENTS = $(PROJECT_DIR)/$(PROJECT_NAME)/Entitlements-$(CONFIGURATION).plist
    CODE_SIGN_IDENTITY = iPhone Developer
    ENABLE_BITCODE = NO
    GCC_PREPROCESSOR_DEFINITIONS = DEBUG=1
    HEADER_SEARCH_PATHS = "$(TARGET_BUILD_DIR)/usr/local/lib/include" "$(OBJROOT)/UninstalledProducts/include" "$(OBJROOT)/UninstalledProducts/$(PLATFORM_NAME)/include" "$(BUILT_PRODUCTS_DIR)"
    OTHER_LDFLAGS = -ObjC
    SWIFT_OBJC_BRIDGING_HEADER = $(PROJECT_DIR)/$(PROJECT_NAME)/Bridging-Header.h

$ 

ionic info

$ ionic info
✔ Gathering environment info - done!

Ionic:

   ionic (Ionic CLI)  : 4.2.1
   Ionic Framework    : ionic-angular 3.9.2
   @ionic/app-scripts : 3.2.1

Cordova:

   cordova (Cordova CLI) : 8.1.2 (cordova-lib@8.1.1)
   Cordova Platforms     : android 7.1.4, browser 5.0.4, ios 4.5.5
   Cordova Plugins       : cordova-plugin-ionic-keyboard 2.0.5, cordova-plugin-ionic-webview 1.1.1, (and 20 other plugins)

System:

   NodeJS : v11.10.0 (/usr/local/Cellar/node/11.10.0/bin/node)
   npm    : 6.7.0
   OS     : macOS High Sierra
   Xcode  : Xcode 10.1 Build version 10B61

$