Skip to content

Ignore the .rnrepo-cache directory within the Metro config - #4262

Merged
m-bert merged 2 commits into
software-mansion:mainfrom
radoslawrolka:rolkrado/rnrepo-metro-exclude
Jun 16, 2026
Merged

Ignore the .rnrepo-cache directory within the Metro config#4262
m-bert merged 2 commits into
software-mansion:mainfrom
radoslawrolka:rolkrado/rnrepo-metro-exclude

Conversation

@radoslawrolka

Copy link
Copy Markdown
Member

Description

This prevents Metro from crashing with an Invariant Violation when internal scripts dynamically recreate this directory or replace it with a symlink during the expo prebuild process in example apps.

<>gesture-handler/apps/expo-example/node_modules/@expo/cli/build/src/utils/errors.js:130
    throw error;
    ^

Invariant Violation: Detected addition or modification of file node_modules/react-native-screens/.rnrepo-cache/Current, but it is tracked as a non-empty directory
    at invariant (<>gesture-handler/apps/expo-example/node_modules/invariant/invariant.js:40:15)
    at TreeFS.addOrModify (<>gesture-handler/apps/expo-example/node_modules/@expo/metro-file-map/build/lib/TreeFS.js:386:41)
    at Timeout.emitChange [as _onTimeout] (<>gesture-handler/apps/expo-example/node_modules/@expo/metro-file-map/build/index.js:580:32)
    at listOnTimeout (node:internal/timers:588:17)
    at process.processTimers (node:internal/timers:523:7) {
  framesToPop: 1
}

Test plan

  1. Without commit
git clone https://github.com/software-mansion/react-native-gesture-handler
cd react-native-gesture-handler
yarn install
cd apps/expo-example
yarn start

# new terminal (2)
cd react-native-gesture-handler/apps/expo-example
yarn ios

# Metro crashes in the first terminal with the Invariant Violation shown above.
  1. With commit
git clone https://github.com/software-mansion/react-native-gesture-handler
cd react-native-gesture-handler
yarn install
cd apps/expo-example
yarn start

# new terminal (2)
cd react-native-gesture-handler/apps/expo-example
yarn ios

# Metro runs normally and no error is thrown in the first terminal

…uration.

This prevents Metro from crashing with an `Invariant Violation` when internal scripts dynamically recreate this directory or replace it with a symlink during the `expo prebuild` process in example apps.
Copilot AI review requested due to automatic review settings June 15, 2026 10:17

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Updates the Expo example Metro configuration to ignore the .rnrepo-cache directory to prevent watchman “Invariant Violation” errors during file watching.

Changes:

  • Adds an exclusion rule intended to ignore .rnrepo-cache and its contents in Metro’s resolver blacklist/block list configuration.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread apps/expo-example/metro.config.js Outdated
Comment thread apps/expo-example/metro.config.js Outdated
@m-bert
m-bert merged commit 50cb5a6 into software-mansion:main Jun 16, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants