Expo web uses the wrong base uri to load assets if you use deep linking

I built a web version of my app using expo web and react-navigation , and I am serving it using Django . I managed to make everything work when I go on mywebsite.com and navigate around.

However, if I load my website directly on mywebsite.com/OTHER/PAGE , this piece of code fails:

await Asset.loadAsync([require("../../assets/images/Logo.png")]),

after some investigation, I found out that instead of loading this asset:

http://mywebsite.com/web-build/static/media/Logo.ceb44efe.png

it tries to load that one (that doesn’t exist):

http://mywebsite.com/OTHER/PAGE/web-build/static/media/Logo.ceb44efe.png

How can I tell it to only use http://mywebsite.com/ as a base URI when loading assets?

I figured it out. My homepage in package.json was set to "homepage": "web-build", and it should have been "homepage": "/web-build"

1 Like