https://github.com/danoc/expo-cli-clear-bug
https://github.com/danoc/expo-cli-clear-bug
Last synced: 5 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/danoc/expo-cli-clear-bug
- Owner: danoc
- Created: 2025-12-26T03:07:40.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2026-02-03T21:04:05.000Z (5 months ago)
- Last Synced: 2026-02-06T03:22:42.335Z (5 months ago)
- Language: Shell
- Size: 375 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Expo CLI Bug: `expo export --clear` doesn't clear Metro cache
Minimal reproduction for `@expo/cli@54.0.20+` where the `--clear` flag doesn't clear Metro's cache.
## The Bug
Running `expo export --clear` with different environment variables produces **identical bundles** (same hash). The cache is not being cleared, causing builds to reuse cached bundles with old environment variables.
## Reproduction
```bash
npm install
npm run test:repro
```
**Expected:** Bundle hashes should be different
**Actual:** Bundle hashes are identical (cache not cleared)
## Testing the Fix
This repo includes a patch file that fixes the bug. You can apply and unapply it to see the difference:
**Step 1: See the bug**
```bash
npm run test:repro
# 🐛 BUG: Bundle hashes are IDENTICAL
```
**Step 2: Apply the fix**
```bash
npm run apply-fix
# Patches @expo/cli with the resetCache fix
```
**Step 3: Verify the fix works**
```bash
npm run test:repro
# ✅ Bundle hashes are different - cache was cleared
```
**Step 4: Remove the fix (optional)**
```bash
npm run unapply-fix
# Reverts @expo/cli to original buggy state
```
You can toggle between fixed and buggy states using `apply-fix` and `unapply-fix`.
## Root Cause
In `@expo/cli@54.0.20` ([commit 34dd4b38a4](https://github.com/expo/expo/commit/34dd4b38a4)), the `resetCache` option was accidentally removed from Metro's config:
**File:** `build/src/start/server/metro/instantiateMetro.js:146-160`
```diff
config = {
...config,
watchFolders: ...,
+ resetCache: options.resetCache, // This line is missing
reporter: ...
};
```
## Affected Versions
- `@expo/cli@54.0.20+` (published Dec 18, 2024)
- `expo@54.0.29+`