Open johkade opened 2 years ago
This is a good question, I'd have to dig a bit deeper into what the best way would be. I'll add an internal task to document this on docs.expo.dev too.
For now, I think it's good to mention a slight behavior change in the classic builds and EAS build (or building it yourself).
assetBundlePatterns
was mostly intended to auto-bundle certain assets, even if they aren't imported (dynamically importing - require(\
./asset/${dynamic}.png`)` - assets is also not detectable, hence this was created).import './assets/my-image.png'
) is bundled automatically. That being said, you should be able to add assets in a workspace package and import it. E.g. with:
import './assets/my-image.png'
)import 'my-pkg/assets/my-image.png'
should work too.
Topic and scope of discussion
When placing assets (e.g. PNGs) in a package folder, they don't seem to be bundled correctly on android and are not displayed. iOS and web work flawlessly.
Motivation
If an asset belongs to a feature, I would like to co-locate it with that feature. And not have to place it in both of the apps as a duplicate, if possible.
Additional context
Even though the
app.json
specifies**/*
as a path to bundle assets, android doesn't show anything where the image should be. iOS and web work without any troubles after a rebuild. Throwing the assets intoexpo/assets
works on all three platforms.It would be great to hear, what the preferred approach for shared assets is with this monorepo-example 🤩
Thanks a lot for any input in advance!