Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix: bundler infinite loop when multiple uniwind instances are installed#570

Merged
Brentlok merged 1 commit into
main from
fix/duplicated-uniwind-instances
Jun 9, 2026
Merged

fix: bundler infinite loop when multiple uniwind instances are installed #570
Brentlok merged 1 commit into
main from
fix/duplicated-uniwind-instances

Conversation

@Brentlok

@Brentlok Brentlok commented Jun 9, 2026
edited by coderabbitai Bot
Loading

Copy link
Copy Markdown
Contributor

fixes #353

Summary by CodeRabbit

  • Bug Fixes
    • Improved Uniwind module resolution in the Metro bundler for more reliable dependency handling.

@Brentlok Brentlok linked an issue Jun 9, 2026 that may be closed by this pull request
2 tasks

coderabbitai Bot commented Jun 9, 2026
edited
Loading

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

i️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 7460b392-3dbc-4f59-8f93-dfedd41042e9

📥 Commits

Reviewing files that changed from the base of the PR and between 433cb71 and 7f3d895.

📒 Files selected for processing (1)
  • packages/uniwind/src/bundler/adapters/metro/metro.ts

📝 Walkthrough

Walkthrough

The Metro adapter now detects requests for uniwind and uniwind/* modules, computes a pinned origin path pointing to the project's package.json, and wraps Metro's resolver to inject this origin into the resolution context for Uniwind requests.

Changes

Metro Resolver Origin Pinning

Layer / File(s) Summary
Uniwind request detection and Metro resolver wrapper
packages/uniwind/src/bundler/adapters/metro/metro.ts
Adds CustomResolver import and join for path operations. Introduces isUniwindRequest predicate to detect uniwind and uniwind/* requests, and computes pinnedUniwindOrigin from config.projectRoot ?? process.cwd() pointing to package.json. Wraps Metro's resolver with a CustomResolver that augments the resolution context with originModulePath: pinnedUniwindOrigin for Uniwind requests while delegating other requests to the base resolver unchanged.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • uni-stack/uniwind#506: Adjusts cachedInternalBasePath computation in resolvers to use require.resolve for more reliable path detection, complementing the originModulePath pinning strategy introduced here.
  • uni-stack/uniwind#283: Earlier work on Metro resolver wrapping that directly influenced the origin pinning approach now being implemented.

Poem

🐰 A Metro's path once spun in loops,
When Uniwind roamed in hidden hoops,
But now we pin the origin true,
And resolvers know just what to do! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: pinning Metro's resolution origin for Uniwind modules to fix the infinite loop caused by multiple Uniwind instances.
Linked Issues check ✅ Passed The PR implements the suggested fix by introducing originModulePath pinning logic that prevents the infinite recursion when Uniwind modules require react-native internally.
Out of Scope Changes check ✅ Passed All changes are directly scoped to fixing the Metro resolver recursion issue by implementing origin resolution pinning for Uniwind modules.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/duplicated-uniwind-instances

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@Brentlok Brentlok merged commit 86e0048 into main Jun 9, 2026
2 checks passed
@Brentlok Brentlok deleted the fix/duplicated-uniwind-instances branch June 9, 2026 12:43

ottob commented Jun 9, 2026

Copy link
Copy Markdown

Thanks!

Brentlok commented Jun 9, 2026

Copy link
Copy Markdown
Contributor Author

Thanks!

You're welcome. This will land in the next release, most likely this week

Copy link
Copy Markdown
Contributor

🚀 This pull request is included in v1.9.0. See Release v1.9.0 for release notes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Metro resolver recursion when separated uniwind instances are installed

2 participants

AltStyle によって変換されたページ (->オリジナル) /