Skip to content

fix(rolldown_plugin_vite_resolve): preserve Yarn PnP virtual importer - #10591

Merged
shulaoda merged 4 commits into
rolldown:mainfrom
Freakazo:fix-yarn-pnp-virtual-importer
Aug 17, 2026
Merged

shulaoda merged 4 commits into
rolldown:mainfrom
Freakazo:fix-yarn-pnp-virtual-importer

Conversation

@Freakazo

@Freakazo Freakazo commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Yarn PnP virtual importer paths can be valid inside a ZIP or virtual path even though
std::fs::exists reports them as missing. That caused Vite resolution to discard
the importer and resolve from the workspace root.

  • Use oxc’s PnP-aware filesystem when deciding whether to preserve an importer.
  • Read optional-peer package metadata through the same filesystem.
  • Share the PnP filesystem/ZIP cache across resolver variants.
  • Add regression coverage for virtual-path metadata and reads.

@codspeed

codspeed Bot commented Aug 3, 2026 •

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 7 untouched benchmarks
⏩ 10 skipped benchmarks1


Comparing Freakazo:fix-yarn-pnp-virtual-importer (7efdd07) with main (533d1a5)

Open in CodSpeed

Footnotes

  1. 10 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

@Freakazo Freakazo changed the title Fix yarn pnp virtual importer fix(pnp) yarn pnp virtual importer Aug 3, 2026
@Freakazo Freakazo changed the title fix(pnp) yarn pnp virtual importer fix(pnp): preserve Yarn PnP virtual importer Aug 3, 2026
@Freakazo

Freakazo commented Aug 5, 2026

Copy link
Copy Markdown
Contributor Author

@shulaoda could you please have a review of this when you have time 🙇

@shulaoda

shulaoda commented Aug 5, 2026

Copy link
Copy Markdown
Member

@shulaoda could you please have a review of this when you have time 🙇

Could you provide a minimal reproduction let me check and verify?

@shulaoda shulaoda self-assigned this Aug 5, 2026
@Freakazo

Freakazo commented Aug 5, 2026

Copy link
Copy Markdown
Contributor Author

@shulaoda
I Added a minimal reproduction repository here

It uses Yarn 4 PnP with a root [email protected] and a workspace app using [email protected] as a peer-dependent workspace package resolved through a Yarn virtual importer.

There's a script yarn repro that can be used for testing.
With [email protected], the repro incorrectly prints:
resolved React version: 18.3.1 (Incorrect)
With the patch it resolves to 17.0.2 (correct)

Testing against yarn own's pnp loader it also resolve to 17.0.2, running yarn proof

@Freakazo
Freakazo force-pushed the fix-yarn-pnp-virtual-importer branch from c339eac to e8a9b03 Compare August 14, 2026 04:51
@Freakazo

Copy link
Copy Markdown
Contributor Author

@shulaoda friendly reminder for this when you have a chance 🙇

I added the minimal reproduction repo linked above

@shulaoda

shulaoda commented Aug 17, 2026 •

Copy link
Copy Markdown
Member

@shulaoda friendly reminder for this when you have a chance 🙇

I added the minimal reproduction repo linked above

Thank you for the reproduction, I will take a look before next release

@shulaoda shulaoda changed the title fix(pnp): preserve Yarn PnP virtual importer fix(rolldown_plugin_vite_resolve): preserve Yarn PnP virtual importer Aug 17, 2026

@shulaoda shulaoda left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM! Thanks for the contribution!

@shulaoda
shulaoda merged commit 95fa2c4 into rolldown:main Aug 17, 2026
33 checks passed
@rolldown-guard rolldown-guard Bot mentioned this pull request Aug 19, 2026
shulaoda added a commit that referenced this pull request Aug 19, 2026
## [1.2.5] - 2026-08-19

### 🚀 Features

- bench: record per-suite peak memory in the node benchmark (#10704) by @IWANABETHATGUY
- binding: allocation-tracking global allocator behind the `tracking_allocator` feature (#10703) by @IWANABETHATGUY
- add armv7 android (armv7-linux-androideabi) support (#10691) by @shulaoda
- add `NAMESPACE_CONFLICT` warning for conflicting star re-exports (#7452) by @AliceLanniste

### 🐛 Bug Fixes

- rolldown_plugin_vite_reporter: avoid ANSI erase-line escape in non-TTY output (#10692) by @shulaoda
- rolldown_plugin_vite_resolve: preserve Yarn PnP virtual importer (#10591) by @Freakazo
- exclude hash placeholders from case-insensitive filename deconfliction (#10590) by @Nic-Polumeyv
- code-splitting: fold already-loaded side-effectful libraries into eager entries (#10645) by @JoviDeCroock
- dev: flush re-emitted assets when their content changes (#10637) by @btea
- renamer: rename nested `require`/`__filename`/`__dirname` bindings in CJS output (#10655) by @marcoroth
- silence two wasm-only warnings (#10668) by @IWANABETHATGUY

### 🚜 Refactor

- skip case folding for filenames with hash placeholders (#10689) by @hyfdev
- code-splitting: remove redundant synthetic statement owner (#10503) by @hyfdev
- renamer: move the cjs check into `rename_bindings_shadowing_cjs_ambient_names` (#10672) by @IWANABETHATGUY

### 📚 Documentation

- agents: point the never-edit list at the binding files that exist (#10719) by @melbinjp

### 🧪 Testing

- deconflict: pin renaming the external process binding away from the global (#10702) by @hyfdev
- dev: expect a hot update across a circular import (#10700) by @hyfdev

### ⚙️ Miscellaneous Tasks

- deps: upgrade oxc to 0.146.0 (#10707) by @Boshen
- deps: update rust crates (#10684) by @renovate[bot]
- deps: update npm packages (#10685) by @renovate[bot]
- build the benchmark comparison window from the JSON lines (#10701) by @IWANABETHATGUY
- wasi: retry the Node Test step to absorb the shared-dlmalloc flake (#10699) by @hyfdev
- append benchmark results to storage as JSON lines (#10682) by @IWANABETHATGUY
- deps: update github actions (#10683) by @renovate[bot]
- deps: update dependency rolldown-plugin-dts to v0.28.2 (#10679) by @renovate[bot]
- deps: update dependency rolldown-plugin-dts to v0.28.1 (#10674) by @renovate[bot]

### ❤️ New Contributors

* @melbinjp made their first contribution in [#10719](#10719)
* @Freakazo made their first contribution in [#10591](#10591)
* @marcoroth made their first contribution in [#10655](#10655)

Co-authored-by: shulaoda <[email protected]>
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