Open
Description
Describe the bug
During evaluation of rolldown-vite, I've noticed that the builds consitently fails when using Yarn PnP when resolving external dependencies.
Tested setups:
✅ works, ❌ does not work, ⌛ TBD
✅ Windows + node_modules
✅ macOS + node_modules
⌛ Linux + node_modules
❌ Windows + PnP
⌛ macOS + PnP
❌ Linux + PnP
Reproduction
I'm unable to provide Stackblitz playground - corepack not enabled in Stackblitz.
Steps to reproduce
- Install a project using Yarn (tested: 4.9.1) using PnP mode
- Add at least one external dependency, if you don't have one already
- Use it in the project
- Build the app
System Info
System:
OS: macOS 15.5
CPU: (10) arm64 Apple M1 Max
Memory: 1014.81 MB / 64.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 24.0.2 - /usr/local/bin/node
Yarn: 4.9.1 - /usr/local/bin/yarn
npm: 11.3.0 - /usr/local/bin/npm
npmPackages:
@vitejs/plugin-basic-ssl: ^1.2.0 => 1.2.0
@vitejs/plugin-react: ^4.3.4 => 4.3.4
rolldown-vite: 6.3.17
Used Package Manager
yarn
Logs
Click to expand!
You or a plugin you are using have set `optimizeDeps.esbuildOptions` but this option is now deprecated. Vite now uses Rolldown to optimize the dependencies. Please use `optimizeDeps.rollupOptions` instead.
rolldown-vite v6.3.17 building for test...
Warning validate output options.
- For the "comments". Invalid key: Expected never but received "comments".
transforming...
✗ Build failed in 2.97s
Browserslist: browsers data (caniuse-lite) is 8 months old. Please run:
npx update-browserslist-db@latest
Why you should do it regularly: https://github.com/browserslist/update-db#readme
PWA v0.21.1
mode generateSW
precache 14 entries (1884.23 KiB)
files generated
dist/service-worker.js.map
dist/service-worker.js
dist/workbox-b1c70e3e.js.map
dist/workbox-b1c70e3e.js
error during build:
Build failed with 1 error:
[plugin vite-plugin-pwa:build]
Error: Build failed with 63 errors:
[UNLOADABLE_DEPENDENCY] Error: Could not load .yarn/__virtual__/styled-components-virtual-059d12ef5d/0/cache/styled-components-npm-6.1.8-ae8d84c2da-fafe4b9198.zip/node_modules/styled-components/dist/styled-components.browser.esm.js
╭─[ src/index.tsx:6:35 ]
│
6 │ import { StyleSheetManager } from "styled-components";
│ ─────────┬─────────
│ ╰─────────── No such file or directory (os error 2)
───╯
[UNLOADABLE_DEPENDENCY] Error: Could not load .yarn/__virtual__/react-dom-virtual-d3eb8ac8e8/0/cache/react-dom-npm-18.3.1-a805663f38-a752496c19.zip/node_modules/react-dom/client.js
╭─[ src/index.tsx:2:28 ]
│
2 │ import { createRoot } from "react-dom/client";
│ ─────────┬────────
│ ╰────────── No such file or directory (os error 2)
───╯
[UNLOADABLE_DEPENDENCY] Error: Could not load .yarn/__virtual__/react-router-dom-virtual-b0aec0a6eb/0/cache/react-router-dom-npm-6.3.0-508f6547e5-490b0c50d4.zip/node_modules/react-router-dom/index.js
╭─[ src/index.tsx:3:41 ]
│
3 │ import { BrowserRouter as Router } from "react-router-dom";
│ ─────────┬────────
│ ╰────────── No such file or directory (os error 2)
───╯
[UNLOADABLE_DEPENDENCY] Error: Could not load .yarn/__virtual__/@unhead-react-virtual-e8ecd5fc65/0/cache/@unhead-react-npm-2.0.8-bc292564f6-a63c47e043.zip/node_modules/@unhead/react/dist/client.mjs
╭─[ src/index.tsx:4:44 ]
│
4 │ import { createHead, UnheadProvider } from "@unhead/react/client";
│ ───────────┬──────────
│ ╰──────────── No such file or directory (os error 2)
───╯
[UNLOADABLE_DEPENDENCY] Error: Could not load .yarn/__virtual__/@wojtekmaj-react-t-virtual-3e773372c2/0/cache/@wojtekmaj-react-t-npm-2.0.2-b8[10](https://github.com/<redacted>/actions/runs/<redacted>/job/<redacted>#step:6:11)f3ea4e-f544785946.zip/node_modules/@wojtekmaj/react-t/dist/index.js
╭─[ src/index.tsx:5:27 ]
│
5 │ import { TProvider } from "@wojtekmaj/react-t";
│ ──────────┬─────────
│ ╰─────────── No such file or directory (os error 2)
───╯
...
at normalizeErrors (file:///home/runner/work/app/app/.yarn/cache/rolldown-npm-1.0.0-beta.[11](https://github.com/<redacted>/actions/runs/15452218415/job/<redacted>#step:6:12)-commit.83d4d62-5157d54ceb-a0d22e5ecb.zip/node_modules/rolldown/dist/shared/src-C1CX2gm4.mjs:2362:18)
at plugin (file:///home/runner/work/app/app/.yarn/cache/rolldown-npm-1.0.0-beta.11-commit.83d4d62-5[15](https://github.com/<redacted>/actions/runs/15452218415/job/<redacted>#step:6:16)7d54ceb-a0d22e5ecb.zip/node_modules/rolldown/dist/shared/src-C1CX2gm4.mjs:2839:[16](https://github.com/<redacted>/actions/runs/15452218415/job/<redacted>#step:6:17)9)
at plugin.<computed> (file:///home/runner/work/app/app/.yarn/cache/rolldown-npm-1.0.0-beta.11-commit.83d4d62-5157d54ceb-a0d22e5ecb.zip/node_modules/rolldown/dist/shared/src-C1CX2gm4.mjs:3800:18)
at normalizeErrors (file:///home/runner/work/app/app/.yarn/cache/rolldown-npm-1.0.0-beta.11-commit.83d4d62-5157d54ceb-a0d22e5ecb.zip/node_modules/rolldown/dist/shared/src-C1CX2gm4.mjs:2362:18)
at handleOutputErrors (file:///home/runner/work/app/app/.yarn/cache/rolldown-npm-1.0.0-beta.11-commit.83d4d62-5157d54ceb-a0d22e5ecb.zip/node_modules/rolldown/dist/shared/src-C1CX2gm4.mjs:3368:34)
at transformToRollupOutput (file:///home/runner/work/app/app/.yarn/cache/rolldown-npm-1.0.0-beta.11-commit.83d4d62-5157d54ceb-a0d22e5ecb.zip/node_modules/rolldown/dist/shared/src-C1CX2gm4.mjs:3362:2)
at RolldownBuild.write (file:///home/runner/work/app/app/.yarn/cache/rolldown-npm-1.0.0-beta.11-commit.83d4d62-5157d54ceb-a0d22e5ecb.zip/node_modules/rolldown/dist/shared/src-C1CX2gm4.mjs:4623:11)
at async buildEnvironment (file:///home/runner/work/app/app/.yarn/__virtual__/rolldown-vite-virtual-3255ab8d6f/0/cache/rolldown-vite-npm-6.3.[17](https://github.com/<redacted>/actions/runs/15452218415/job/<redacted>#step:6:18)-8a6bfedfd2-9ddd057a3a.zip/node_modules/rolldown-vite/dist/node/chunks/dep-BVD1pq3j.js:44451:16)
at async Object.defaultBuildApp [as buildApp] (file:///home/runner/work/app/app/.yarn/__virtual__/rolldown-vite-virtual-3[25](https://github.com/<redacted>/actions/runs/15452218415/job/<redacted>#step:6:26)5ab8d6f/0/cache/rolldown-vite-npm-6.3.17-8a6bfedfd2-9ddd057a3a.zip/node_modules/rolldown-vite/dist/node/chunks/dep-BVD1pq3j.js:44957:5)
at async CAC.<anonymous> (file:///home/runner/work/app/app/.yarn/__virtual__/rolldown-vite-virtual-[32](https://github.com/<redacted>/actions/runs/15452218415/job/<redacted>#step:6:33)55ab8d6f/0/cache/rolldown-vite-npm-6.3.17-8a6bfedfd2-9ddd057a3a.zip/node_modules/rolldown-vite/dist/node/cli.js:864:7)
Error: Process completed with exit code 1.
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs and the Rolldown-related guide.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.