Ionic 3 –release Stuck on Splash or White Screen
I recently encountered an issue when the builds coming from my TeamCity CI server for an Ionic 3 (3.9.9) app would stay stuck on the Cordova Splashscreen or if I removed the Splashscreen plugin just sit on a completely White screen when the app loaded. There were no errors from what I could tell outside of a random error:
[object ErrorEvent]
Not much information there. Builds without using the “–release” parameter worked fine and didn’t get stuck on either a whitescreen or the native splashscreen. This, from what I can tell is all versions of iOS and Android that I could test on. What I eventually found out, is that it’s a typescript issue. When I look at my package.json file, Typescript was defined as this:
The issue is the Tilde operator “~” in front of the version, although I installed 2.8.4 of Typescript when my CI server ran there was patch version and my server downloaded the latest one. Note that if you use a package-lock.json file you usually avoid this issue as the CI server will use that specific DL for the install, but I always remove that file as it causes merge conflicts and other issues.
To see what the Tilde operator does we can view that from Npmjs’s Semver documentation but I’ll include the most common semver pre-fixes that I find cause issues.
So armed with that information, I figured out CI was downloading a newer version of Typescript, like 2.8.5, instead of 2.8.4. To fix this issue I removed my package-lock.json file and locked my Typescript version to
After that I got past the Splascreen and Whitescreen issue. You don’t the equals “=” in front of the version number, as just having the number in there does the same thing, but I like adding it as a key that I’ve manually pegged the version for a specific reason.