I’m building an app with React Native / Expo SDK 54.
The app bundles ~42,000 compressed HTML files (.zst format, ~224 MB compressed) that need to be accessible without network access.
The Problem
My production iOS build is 325 MB, but on first launch it creates another 330 MB in “Documents and Data” – basically duplicating all the assets.
First launch also takes 1+ minute, which is unacceptable.
What I’ve Tried
Originally used Asset.fromModule() with imports for each doc file.
- This causes Expo to automatically extract all imported assets to cache on first launch.
- Hence the duplication and slow startup.
Tried accessing files via Paths.bundle with the new File API (SDK 54).
- Files don’t exist there.
- I think this is because I’m importing them, so they’re embedded in the JS bundle, not included as separate bundled assets.
Tested multiple asset access methods in production.
- Only
asset.localUriworks, but it points to the extracted cache location (the duplication I’m trying to avoid). - Same with
DownloadAsync– works, but duplicates the file and is slower.
What I Want
Files should be bundled in the app at build time, then read directly from the bundle on-demand when a user opens a doc page.
It shouldn’t need to copy anything – just open the bundled file and read its bytes.
This feels like it should be simple – the files are in the bundle (325 MB proves it).
I just want to read them without Expo copying them to cache first.
It also works perfectly in development builds and on web – it’s just native production builds causing issues.
Current Architecture
- Thousands of
.zstcompressed HTML files - Manifests with import statements for each file (auto-generated)
- Files referenced by hash in the manifest, loaded on-demand when a user navigates to a page
- zst filetype is added as external asset to the metro config
- Currently not doing anything in app.json for these assets
Questions
-
Should I use
assetBundlePatternsinstead of imports?
Would that make them accessible viaPaths.bundle? -
Is there a way to bundle files without imports so Expo doesn’t auto-extract them?
-
Is the
asset.localUriextraction unavoidable when usingAsset.fromModule()? -
Should I be using a completely different approach for bundling this many files?
Or not bundle them at all and access them another way?
Environment:
- Expo SDK 54
- React Native 0.81.5
- EAS Build (production iOS builds)
- New architecture enabled