Fonts loading compatibility with bare workflow and expo client

We’re using bare workflow to build our app, generating our bundle with ‘expo export’.
The fonts are correctly imported and loaded in our bare app, but they fail to load when we run the same bundle on the expo client (both default expo-icons and custom ones are rendered as ? ).
We get no error message suggesting that the fonts are not loaded correctly, they just don’t get rendered.
We found out that we can make it work correctly in expo client by changing the template of the bundle when exporting ‘expo export --template managed’, like suggested in ([SDK 37] Expo Icons display as [ ? ] only in standalone iOS and published iOS · Issue #8107 · expo/expo · GitHub) but this makes the native bare app fail to build.

Is there a way to make the bundle work for both expo client and bare app?

1 Like

+1 - Also interested to hear a solution on this. Running a JS bundle on both the Expo Client and our own Native App is the dream.

Issue on expo-cli: Fonts loading compatibility with bare workflow and expo client · Issue #2098 · expo/expo-cli · GitHub

hey there! this isn’t well documented, but you can do the following:

use different release channels when publishing for expo client and for standalone apps. for example, maybe you use the default channel for expo client and the prod channel for standalone apps. then you would run expo publish --target managed --release-channel default and it would publish to the default channel with config to run in expo client. if you run expo publish --target bare --release-channel prod it would publish to the prod channel with the bare config. the default value for release channel is default and the default value for target is bare in a bare app and managed in a managed app. so you could alternatively just write expo publish --target managed and expo publish --release-channel prod to accomplish the same thing as those commands

2 Likes

Thanks for the quick response!
We host the bundles internally, so we can’t leverage release-channels.
So you confirm that we have to host 2 different bundles to run for bare and managed workflows?

1 Like

Just to clarify, we’re generating our bundle with expo export and hosting the bundle ourselves. I notice there is no —release-channel option on export export. Is there any other work around other than us implementing our own release channel logic?

Note: We used to just run one bundle that worked on Expo Client and our Native App before upgrading to the bare workflow.

indeed, the bare workflow has a different build process. from the issue you mentioned: Fonts loading compatibility with bare workflow and expo client · Issue #2098 · expo/expo-cli · GitHub

my reply:

yup, the build process is different between the two. for example, in managed apps we pull in files with the .expo.[js/ts/jsx/tsx] extension with higher priority than other extensions, and so the resulting build ends up being quite different since some libraries depend on this to differentiate between managed and bare workflow.

you might want to use the .expo extension to provide fallbacks for native modules that you’ve included in your bare project but aren’t available in the expo client. Custom native code in Expo Go - Expo Documentation

to add to this - we’re most likely going to change this so that when you publish to bare workflow that release isn’t available at all in the client. you will have to explicitly publish expo publish --target managed (or maybe --target client to be very clear). we’re still working on figuring out the best way to handle this. the ideal is, in my opinion, to have it just work in both contexts, but this is tricky right now due to significant differences between the client and bare app environments.

for release channels - you can get the same sort of functionality by hosting the app at different urls. eg:

expo export --target managed --public-url https://myapp.com/releases/dev
expo export --target bare --public-url https://myapp.com/releases/prod-v1
1 Like

We’re using bare workflow to build our app, generating our bundle with expo export.

Hello!

I upgraded to expo 37 and I have this issue only with my android release build.
No icon is showing up, using createIconSetFromIcoMoon from @expo/vector-icons.
It works fine on android in the debug build.
I’m using expokit, I know it will be deprecated, but for now i can’t look into migrating to bare.
I tried adding --target bare to my expo publish prior to the android building process, but still no icons.

It is worth mentioning as well that before my icons where structured as such:
/assets/fonts/my-icons.json
/assets/fonts/my-icons.ttf

But since i had an android build issue saying that i had duplicate resources (as if it was not differentiating json and ttf…?) based on some similar issues found online i moved to
/assets/fonts/my-icons.json
/assets/config/my-icons.ttf

Would this have any incidence on the release build?

I spent the whole day trying to fix this icon issue but no success so far.

Do I have no other choice than do the migration to bare as seen here Time to Start Using Expo’s Bare Workflow. ExpoKit Now Deprecated. | by Eric Samelson | Exposition ?

Thank you!