Torben Nordtorp
Torben Nordtorp

Reputation: 324

Expo Web & Firebase Hosting: Header meta tags present in exported raw html file, but not when serving through Firebase hosting

I'm using Expo Router. I've created some routes and used the Head component to add static meta data tags. Running npx expo export -p web creates the routes in my dist/ folder. When opening those html files I can see that they have the required meta tags present.

However when deploying said files to firebase hosting, I can see that the initial page load does not contain the header tags! I'm very confused as to why. Any help is apprechiated.

Upvotes: 0

Views: 88

Answers (1)

Torben Nordtorp
Torben Nordtorp

Reputation: 324

I figured out that the issue was when I initally ran firebase init I had said I wanted a singel page application, so there was a reroute in my firebase.json file that redirected everything to index.html.

Removing that and adding "cleanUrls": true to my firebase json config solved the issue!

my firebase.json hosting section now looks like this:

"hosting": {
     "public": "dist",
     "ignore": ["firebase.json", "**/.*", "**/node_modules/**"],
     "cleanUrls": true
},

Upvotes: 0

Related Questions