I've built a React.js app that works perfectly on desktop and Android, but on iOs it just shows a blank white screen. I've been reading in different places it has to do with the homepage
in my package.json
, but I can't understand what the right configuration is. I've bee trying many different variations, but it's still white.
some people say it needs to be
"homepage":"."
others say it should be "homepage":"https://yoursite.com/relativeurl"
. I'm not even sure with the second, what goes instead of relative url
?
Some show it with https://
some say make sure it starts with http://
.
Been playing around with this for 3 hours now but still just a blank white screen on my iPad but perfectly fine on my desktop.
EDIT: I've added the headers to my firebase.json
, making my final file look as follow:
{
"firestore": {
"rules": "firestore.rules",
"indexes": "firestore.indexes.json"
},
"functions": {
"predeploy": [
"npm --prefix \"$RESOURCE_DIR\" run lint",
"npm --prefix \"$RESOURCE_DIR\" run build"
]
},
"hosting": {
"public": "build",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"headers": [
{"source": "/service-worker.js", "headers": [{"key": "Cache-Control", "value": "no-cache"}]}
],
"rewrites": [
{
"source": "**",
"destination": "/index.html"
}
]
},
"storage": {
"rules": "storage.rules"
}
}
In my main index.js
body tag, I configure firebase as follows:
<!-- The core Firebase JS SDK is always required and must be listed first -->
<script src="https://www.gstatic.com/firebasejs/7.14.1/firebase-app.js"></script>
<!-- TODO: Add SDKs for Firebase products that you want to use
https://firebase.google.com/docs/web/setup#available-libraries -->
<script src="https://www.gstatic.com/firebasejs/7.14.1/firebase-analytics.js"></script>
<!-- The core Firebase JS SDK is always required and must be listed first -->
<script src="/__/firebase/7.14.1/firebase-app.js"></script>
<!-- TODO: Add SDKs for Firebase products that you want to use
https://firebase.google.com/docs/web/setup#available-libraries -->
<script src="/__/firebase/7.14.1/firebase-analytics.js"></script>
<!-- Initialize Firebase -->
<script src="/__/firebase/init.js"></script>
<div id="root"></div>