fix(rsc): pass root importer explicitly instead of undefined for this.resolve in rsc:virtual-client-package - #1295
Conversation
|
@hi-ogawa can you have a look, latest version blocks our builds 🙏 |
|
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 |
Co-authored-by: OpenCode <noreply@opencode.ai>
Co-authored-by: OpenCode <noreply@opencode.ai>
Co-authored-by: OpenCode <noreply@opencode.ai>
undefined for this.resolve in rsc:virtual-client-package
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:
Related to #1247 and #1277.