Skip to content

Fix scanning Yarn PnP workspace packages - #20485

Open
OllieinCanada wants to merge 1 commit into
tailwindlabs:mainfrom
OllieinCanada:codex/issue-17739
Open

Fix scanning Yarn PnP workspace packages#20485
OllieinCanada wants to merge 1 commit into
tailwindlabs:mainfrom
OllieinCanada:codex/issue-17739

Conversation

@OllieinCanada

Copy link
Copy Markdown

Summary

  • Resolve Yarn PnP virtual source bases to their real backing directories only at the Vite-to-native-scanner boundary.
  • Preserve the original CSS/JS module identity and every source pattern and negation for compiler and resolver behavior.
  • Leave ZIP-backed paths untouched because resolveVirtual can still return a path inside a ZIP archive; this is not a general PnP filesystem implementation.
  • Add a packed-artifact Yarn PnP integration test whose React peer dependency demonstrably creates a virtual workspace path. The test covers source(none), an explicit source, a negated source, prefixing, and a relative JS plugin.

Fixes #17739.

Test plan

pnpm --filter @tailwindcss/vite build
pnpm exec prettier --check packages/@tailwindcss-vite/src/index.ts integrations/vite/yarn-pnp.test.ts
pnpm exec vitest run --root=./integrations vite/yarn-pnp.test.ts

The packed-artifact regression was checked against an unmodified current-main Vite tarball: baseline fails to emit the workspace utilities, the candidate passes, swapping back to baseline fails again, and restoring the candidate passes. A normal non-PnP Vite smoke build produced byte-identical CSS, and an alternating 20-build benchmark showed no meaningful overhead.

Scope

This fixes scanning for Yarn virtual packages backed by real files. It intentionally does not make Oxide scan Yarn ZIP archives or Vite in-memory virtual modules.

@OllieinCanada
OllieinCanada requested a review from a team as a code owner September 11, 2026 15:15
@greptile-apps

greptile-apps Bot commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

The PR appears safe to merge, with no concrete correctness, security, or repository-rule violations identified.

Reviews (1) · Last reviewed commit: "Fix scanning Yarn PnP workspace packages"

@coderabbitai

coderabbitai Bot commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 559400ab-6a78-486a-a603-da69a0a30eb2

📥 Commits

Reviewing files that changed from the base of the PR and between 41d9cae and 249ff13.

📒 Files selected for processing (2)
  • integrations/vite/yarn-pnp.test.ts
  • packages/@tailwindcss-vite/src/index.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 7 remain after this review.


Walkthrough

The Vite plugin now resolves Yarn PnP virtual source paths before constructing its scanner. It preserves paths that resolve inside zip archives. A new integration test creates a Yarn 4 workspace, verifies virtual dependency resolution, runs a Vite build, and checks that expected utilities are generated while excluded utilities are absent.

Priority: ➖ Normal

Severity of issue fixed: Medium

Merge Risk: ⚪ Minimal · up to 249ff

The Yarn PnP scanner-path change is covered by an integration test and does not leave a concrete merge-blocking risk.

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description check ✅ Passed The description directly explains the Yarn PnP scanning fix, its scope, integration test coverage, validation steps, and known ZIP-backed limitations.
Title check ✅ Passed The title clearly and concisely identifies the main change: fixing scanning of Yarn PnP workspace packages.
Linked Issues check ✅ Passed The PR addresses issue #17739. packages/@tailwindcss-vite/src/index.ts resolves Yarn PnP virtual source bases with Module.findPnpApi(...).resolveVirtual(...) before native scanner construction. It…
Out of Scope Changes check ✅ Passed The changed files stay within issue #17739. The implementation changes Vite scanner path handling for Yarn PnP packages. The integration test validates the reported monorepo failure mode and related s…

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.

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.

No classes generated in monorepo setup with Yarn PnP

1 participant