Uhg… been spending all day on this and can’t figure it out…
We’ve used assetBundlePatterns in app.json to bundle up a background image for a landing screen.
After doing an exp build: ios we changed the .ipa file to .zip and verified the image is bundled in the app package.
As a final test we open the app with the phone in airplane mode. Sadly, the background is all white (the default screen background color). If we turn airplane mode off and reload the app, the background is white for a couple seconds and then the image is loaded (clearly being downloaded from the expo cdn).
What I don’t get is the following.
In app.json the asset bundle is defined as a wildcard.
There are a few images in the folder but only the one used in the app is bundled in the ipa. From reading around the forum this is expected behavior as Expo only bundles files actually used in the app.
If the image is bundled correctly because of it’s reference in the app code, why isn’t the image actually pulled from the bundle cache when using the app?
Is there a different way we should be referencing the bundled image location to correctly pull from the bundle cache?
assetBundlePatterns are resolved relatively to the root of your project (where app.json is). I’m not sure what exactly could cause your issue, could you try adding some logs here (should be under node_modules/xdl) and validate that the paths seem good? We use minimatch to validate if the pattern matches the file url. Also the bundling happens at publish time so you can run exp publish to execute the code with the logs.
Update! Thanks to @notbrent in the Slack channel I was able to track down the correct node_modules folder to edit and see the results when doing an exp publish from the command line.
For anyone following along and using Windows 10, the location is C:\Users\<UserName>\AppData\Roaming\npm
I was able to verify exp is using the correct full paths and bundling the image.
Here’s what I logged.
the way it is mapped is by taking the md5 of the file and adding that to the asset metadata, then at runtime we check if that file exists on disk, and if so we use it, otherwise we go to the network.
@gollyjer - can you do a simulator build (exp build:ios -t simulator) and share that with me either privately on slack or here? thanks!
Circling back it turns out my exp cli wasn’t up to date. I was running 53.1 and after upgrading to 54 bundling seems to be working as expected. Thanks!
Sorry for wasting your time. It’s not like me have my tools out of date when asking a question about new features.