Production build failing on iOS

Currently i’m kinda lost, tried several things, but I still get this error, and I can’t find any clue on where to look.

I’m doing a production build (ionic cordova prepare ios --prod --release) which successfully builds. But upon running it on iOS (using Xcode on the simulator, or directly on an iPhone) the splashscreen shows with the “spinner”, and there it stays. In the log window of Xcode/Safari I do see that several other data of the application is loaded/processed, so under the splash screen the app is building up the screen with what to show.

ERROR: Unhandled Promise rejection: undefined is not an object (near '...,t),t[i]),E)})(r,e)).then&&(o=await o),o...') ; Zone: <root> ; Task: Promise.then ; Value: TypeError: undefined is not an object (near '...,t),t[i]),E)})(r,e)).then&&(o=await o),o...') ionic://localhost/main-latest.a5adcb5b80b4647a2721.js:1:687411
asyncFunctionResume@[native code]
value@ionic://localhost/polyfills-latest.9367b0957c85ca80c13b.js:1:5388
ionic://localhost/polyfills-latest.9367b0957c85ca80c13b.js:1:18355
value@ionic://localhost/polyfills-latest.9367b0957c85ca80c13b.js:1:6180
m@ionic://localhost/polyfills-latest.9367b0957c85ca80c13b.js:1:14336
promiseReactionJob@[native code]

Another weird thing is, that is sometimes helps if I delete the node_modules directory, then do an npm install and then do the build… Sometimes…

Any clue where I should start looking?

Ionic:
   Ionic CLI                     : 6.4.3
   Ionic Framework               : @ionic/angular 4.11.10
   @angular-devkit/build-angular : 0.803.26
   @angular-devkit/schematics    : 8.3.26
   @angular/cli                  : 8.3.26
   @ionic/angular-toolkit        : 2.2.0

Cordova:
   Cordova CLI       : 9.0.0 (cordova-lib@9.0.1)
   Cordova Platforms : android 8.1.0
   Cordova Plugins   : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 4.1.3, (and 16 other plugins)
Utility:
   cordova-res                          : not installed
   native-run (update available: 1.0.0) : 0.3.0

System:
   Android SDK Tools : 26.1.1
   ios-deploy        : 1.9.4
   ios-sim           : 8.0.2
   NodeJS            : v12.16.1
   npm               : 6.14.4
   OS                : macOS Catalina
   Xcode             : Xcode 11.4 Build version 11E146

Edit 2: I’ve noticed that when I clear the node_modules directory the first build will always work on the device/emulator. The builds after that are not working anymore.