FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

fix(rsc): pass root importer explicitly instead of `undefined` for `this.resolve` in `rsc:virtual-client-package` by nihgwu · Pull Request #1295 · vitejs/vite-plugin-react · GitHub

fix(rsc): pass root importer explicitly instead of undefined for this.resolve in rsc:virtual-client-package - #1295

Merged
hi-ogawa merged 5 commits into
vitejs:mainfrom
nihgwu:neo/fix-rsc-client-packages-outside-root
Jul 23, 2026
Merged

hi-ogawa merged 5 commits into
vitejs:mainfrom
nihgwu:neo/fix-rsc-client-packages-outside-root

Conversation

nihgwu commented Jul 20, 2026
edited by hi-ogawa
Loading

Copy link
Copy Markdown
Contributor

Description

@vitejs/plugin-rsc 0.5.28 added a project-root resolution check for client packages in #1277. In Rolldown builds, passing an undefined importer does not reliably represent the project root and can send importer-sensitive resolvers through a framework-owned dependency graph instead. In our case this caused runaway resolution and module-graph growth, ending in an OOM during the first RSC transform.

Resolve the package from the conventional /index.html importer explicitly. This preserves the #1277 behaviour: packages unavailable at the application root, or resolving to a different copy there, still fall back to the fully resolved module id.

Add a regression guard to the existing transitive client package fixture so build coverage fails if the root probe reaches another resolver without a concrete importer.

Reproduced with identical documentation content:

  • @vitejs/plugin-rsc 0.5.27: build succeeds
  • 0.5.28: build OOMs
  • patched 0.5.28: build succeeds

Related to #1247 and #1277.

nihgwu commented Jul 21, 2026

Copy link
Copy Markdown
Contributor Author

@hi-ogawa can you have a look, latest version blocks our builds 🙏

Copy link
Copy Markdown
Contributor

Doing this explicitly does make sense (I remember just seeing this on Vitest https://github.com/vitest-dev/vitest/blob/86c700ed8b77b7afb0ee9ec677ef8379f34a4bed/packages/vitest/src/node/plugins/vitestResolver.ts#L55) and fine to land nonetheless, but I'd appreciate more content on your setup.

Vite’s built-in resolver already resolves bare packages from the project root when the importer is undefined, so undefined and <root>/index.html should behave the same there. The reported difference therefore seems to come from another plugin handling this.resolve() first. Could you provide the full Vite config and plugin list from the failing setup so we can understand that interaction?

hi-ogawa 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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

for above

hi-ogawa changed the title fix(rsc): handle client packages outside root fix(rsc): pass root importer explicitly instead of undefined for this.resolve in rsc:virtual-client-package Jul 23, 2026
hi-ogawa merged commit 372a0e7 into vitejs:main Jul 23, 2026
20 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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.

2 participants


Back | FazBrowse Home | New Git URL