nextjs - ✅(Solved) Fix Standalone can't be builded if pnpm-virtual-store outside of node_modules [1 pull requests, 2 comments, 3 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
vercel/next.js#84342Fetched 2026-04-08 02:19:46
View on GitHub
Comments
2
Participants
3
Timeline
7
Reactions
3
Author
Timeline (top)
subscribed ×3commented ×2cross-referenced ×1issue_type_added ×1

Fix Action

PR fix notes

PR #1639: turbopack support

Description (problem / solution / changelog)

adds turbopack support to @vanilla-extract/next-plugin

turbopack doesn't have any sort of external API yet, so in order to evaluate the contents of our *.css.ts files we need to compile it separately using @vanilla-extract/compiler. To avoid import resolution mismatches, we defer module resolution to turbopack via its webpack-compatible api.

next/font doesn't work out of the box because turbopack has custom logic for it, so we transform any modules that use it in a css context to contain static references to the generated font family, style, and weight. next/image gets a similar treatment. most other next modules won't work in css.ts files for now.

fixes #1367

Changed files

  • .changeset/fresh-wombats-stick.md (added, +7/-0)
  • .changeset/green-years-yawn.md (added, +5/-0)
  • .changeset/heavy-boxes-protect.md (added, +5/-0)
  • .changeset/tough-mails-jog.md (added, +5/-0)
  • .gitignore (modified, +1/-0)
  • .prettierignore (modified, +1/-0)
  • fixtures/next-12-pages-router/CHANGELOG.md (renamed, +0/-0)
  • fixtures/next-12-pages-router/next.config.js (renamed, +0/-0)
  • fixtures/next-12-pages-router/package.json (renamed, +1/-3)
  • fixtures/next-12-pages-router/src/pages/features/index.tsx (renamed, +0/-0)
  • fixtures/next-12-pages-router/src/pages/index.tsx (renamed, +0/-0)
  • fixtures/next-12-pages-router/src/pages/recipes/index.tsx (renamed, +0/-0)
  • fixtures/next-12-pages-router/src/pages/sprinkles/index.tsx (renamed, +0/-0)
  • fixtures/next-12-pages-router/tsconfig.json (renamed, +3/-1)
  • fixtures/next-13-app-router/CHANGELOG.md (renamed, +0/-0)
  • fixtures/next-13-app-router/next.config.js (renamed, +0/-3)
  • fixtures/next-13-app-router/package.json (renamed, +2/-4)
  • fixtures/next-13-app-router/src/app/features/page.tsx (renamed, +0/-0)
  • fixtures/next-13-app-router/src/app/layout.tsx (renamed, +0/-0)
  • fixtures/next-13-app-router/src/app/page.tsx (renamed, +0/-0)
  • fixtures/next-13-app-router/src/app/recipes/page.tsx (renamed, +0/-0)
  • fixtures/next-13-app-router/src/app/sprinkles/page.tsx (renamed, +0/-0)
  • fixtures/next-13-app-router/tsconfig.json (renamed, +2/-1)
  • fixtures/next-16-app-pages-router/next.config.ts (added, +15/-0)
  • fixtures/next-16-app-pages-router/package.json (added, +32/-0)
  • fixtures/next-16-app-pages-router/src/app/creepster/page.tsx (added, +9/-0)
  • fixtures/next-16-app-pages-router/src/app/duplication-test/a-plain.css.ts (added, +5/-0)
  • fixtures/next-16-app-pages-router/src/app/duplication-test/a.css.ts (added, +9/-0)
  • fixtures/next-16-app-pages-router/src/app/duplication-test/b-plain.css.ts (added, +5/-0)
  • fixtures/next-16-app-pages-router/src/app/duplication-test/b.css.ts (added, +9/-0)
  • fixtures/next-16-app-pages-router/src/app/duplication-test/extra/c-plain.css.ts (added, +5/-0)
  • fixtures/next-16-app-pages-router/src/app/duplication-test/extra/c.css.ts (added, +9/-0)
  • fixtures/next-16-app-pages-router/src/app/duplication-test/page.tsx (added, +18/-0)
  • fixtures/next-16-app-pages-router/src/app/features/page.tsx (added, +10/-0)
  • fixtures/next-16-app-pages-router/src/app/function-serializer/page.tsx (added, +12/-0)
  • fixtures/next-16-app-pages-router/src/app/function-serializer/runtime.tsx (added, +14/-0)
  • fixtures/next-16-app-pages-router/src/app/function-serializer/source.css.ts (added, +12/-0)
  • fixtures/next-16-app-pages-router/src/app/function-serializer/styled.ts (added, +28/-0)
  • fixtures/next-16-app-pages-router/src/app/layout.tsx (added, +11/-0)
  • fixtures/next-16-app-pages-router/src/app/next-font/page.tsx (added, +41/-0)
  • fixtures/next-16-app-pages-router/src/app/next-image/image.css.ts (added, +13/-0)
  • fixtures/next-16-app-pages-router/src/app/next-image/logo.png (added, +0/-0)
  • fixtures/next-16-app-pages-router/src/app/next-image/page.tsx (added, +5/-0)
  • fixtures/next-16-app-pages-router/src/app/page.tsx (added, +23/-0)
  • fixtures/next-16-app-pages-router/src/app/recipes/page.tsx (added, +10/-0)
  • fixtures/next-16-app-pages-router/src/app/sprinkles/page.tsx (added, +10/-0)
  • fixtures/next-16-app-pages-router/src/pages/pages-router/features/index.tsx (added, +10/-0)
  • fixtures/next-16-app-pages-router/src/pages/pages-router/index.tsx (added, +13/-0)
  • fixtures/next-16-app-pages-router/src/pages/pages-router/recipes/index.tsx (added, +10/-0)
  • fixtures/next-16-app-pages-router/src/pages/pages-router/sprinkles/index.tsx (added, +10/-0)
  • fixtures/next-16-app-pages-router/src/styles/creepster-font.ts (added, +8/-0)
  • fixtures/next-16-app-pages-router/src/styles/creepster.css.ts (added, +8/-0)
  • fixtures/next-16-app-pages-router/src/styles/fonts.ts (added, +251/-0)
  • fixtures/next-16-app-pages-router/src/styles/fonts/Inter-Regular.woff2 (added, +0/-0)
  • fixtures/next-16-app-pages-router/src/styles/nextFont.css.ts (added, +22/-0)
  • fixtures/next-16-app-pages-router/tsconfig.json (added, +42/-0)
  • fixtures/next-app-router/next-env.d.ts (removed, +0/-5)
  • fixtures/next-pages-router/next-env.d.ts (removed, +0/-5)
  • package.json (modified, +6/-5)
  • packages/compiler/src/compiler.ts (modified, +53/-10)
  • packages/css/package.json (modified, +3/-1)
  • packages/css/vanilla.virtual.css (added, +10/-0)
  • packages/next-plugin/package.json (modified, +4/-1)
  • packages/next-plugin/src/index.ts (modified, +176/-82)
  • packages/turbopack-plugin/package.json (added, +35/-0)
  • packages/turbopack-plugin/src/index.test.ts (added, +145/-0)
  • packages/turbopack-plugin/src/index.ts (added, +219/-0)
  • packages/turbopack-plugin/src/next-font/inject.ts (added, +47/-0)
  • packages/turbopack-plugin/src/next-font/plugin.ts (added, +16/-0)
  • packages/turbopack-plugin/src/next-font/transform.ts (added, +299/-0)
  • playwright.config.ts (modified, +11/-1)
  • pnpm-lock.yaml (modified, +873/-409)
  • site/docs/integrations/next.md (modified, +75/-26)
  • test-helpers/package.json (modified, +3/-2)
  • test-helpers/src/startFixture/index.ts (modified, +5/-1)
  • test-helpers/src/startFixture/next.ts (modified, +6/-3)
  • tests/e2e/css-deduplication.playwright.ts (added, +40/-0)
  • tests/e2e/fixtures-next-development.playwright.ts (removed, +0/-72)
  • tests/e2e/fixtures-next-production.playwright.ts (removed, +0/-46)
  • tests/e2e/fixtures-next-unified.playwright.ts (added, +91/-0)
  • tests/e2e/snapshots/creepster-Desktop---Chromium-darwin.png (added, +0/-0)
  • tests/e2e/snapshots/creepster-Mobile---Chromium-darwin.png (added, +0/-0)
  • tests/e2e/snapshots/duplication-test-Desktop---Chromium-darwin.png (added, +0/-0)
  • tests/e2e/snapshots/duplication-test-Mobile---Chromium-darwin.png (added, +0/-0)
  • tests/e2e/snapshots/function-serializer-Desktop---Chromium-darwin.png (added, +0/-0)
  • tests/e2e/snapshots/function-serializer-Mobile---Chromium-darwin.png (added, +0/-0)
  • tests/e2e/snapshots/next-font-Desktop---Chromium-darwin.png (added, +0/-0)
  • tests/e2e/snapshots/next-font-Mobile---Chromium-darwin.png (added, +0/-0)
  • tests/e2e/snapshots/next-font-webpack-Desktop---Chromium-darwin.png (added, +0/-0)
  • tests/e2e/snapshots/next-font-webpack-Mobile---Chromium-darwin.png (added, +0/-0)
  • tests/e2e/snapshots/next-image-Desktop---Chromium-darwin.png (added, +0/-0)
  • tests/e2e/snapshots/next-image-Mobile---Chromium-darwin.png (added, +0/-0)
  • tests/package.json (modified, +0/-1)
  • tests/servers.ts (added, +66/-0)

Code Example

pnpm i --virtual-store-dir ~/.cache/vstore/app/
next build --webpack

---

Operating System:
  Platform: linux
  Arch: x64
  Version: #1 SMP PREEMPT_DYNAMIC Sun Aug  6 20:05:33 UTC 2023
  Available memory (MB): 4102
  Available CPU cores: 2
Binaries:
  Node: 20.9.0
  npm: 9.8.1
  Yarn: 1.22.19
  pnpm: 8.10.2
Relevant Packages:
  next: 15.6.0-canary.34 // Latest available version is detected (15.6.0-canary.34).
  eslint-config-next: N/A
  react: 19.1.1
  react-dom: 19.1.1
  typescript: N/A
Next.js Config:
  output: standalone
RAW_BUFFERClick to expand / collapse

Link to the code that reproduces this issue

https://codesandbox.io/p/devbox/relaxed-cohen-7cps4h

To Reproduce

pnpm i --virtual-store-dir ~/.cache/vstore/app/
next build --webpack

Current vs. Expected behavior

current behavior

in the .next/standalone/node_modules will be incorrect dependencies with broken symlinks

expected behavior

in the .next/standalone/node_modules correct dependencies

Provide environment information

Operating System:
  Platform: linux
  Arch: x64
  Version: #1 SMP PREEMPT_DYNAMIC Sun Aug  6 20:05:33 UTC 2023
  Available memory (MB): 4102
  Available CPU cores: 2
Binaries:
  Node: 20.9.0
  npm: 9.8.1
  Yarn: 1.22.19
  pnpm: 8.10.2
Relevant Packages:
  next: 15.6.0-canary.34 // Latest available version is detected (15.6.0-canary.34).
  eslint-config-next: N/A
  react: 19.1.1
  react-dom: 19.1.1
  typescript: N/A
Next.js Config:
  output: standalone

Which area(s) are affected? (Select all that apply)

Not sure

Which stage(s) are affected? (Select all that apply)

next build (local)

Additional context

extent analysis

TL;DR

  • The issue with incorrect dependencies and broken symlinks in .next/standalone/node_modules may be resolved by adjusting the --virtual-store-dir configuration or disabling the global virtual store in pnpm.

Guidance

  • Verify that the --virtual-store-dir path ~/.cache/vstore/app/ is correctly configured and accessible during the next build process.
  • Check the pnpm documentation for any known issues or limitations related to the global virtual store and --virtual-store-dir option.
  • Consider disabling the global virtual store by setting enableGlobalVirtualStore to false in the pnpm settings to see if it resolves the issue.
  • Review the Next.js configuration and ensure that the output setting is correctly set to standalone and that there are no other configuration issues that could be contributing to the problem.

Example

No code snippet is provided as the issue is related to configuration and dependency management.

Notes

  • The issue may be specific to the combination of pnpm, Next.js, and the global virtual store configuration.
  • Disabling the global virtual store or adjusting the --virtual-store-dir configuration may impact performance optimizations.

Recommendation

  • Apply workaround: Adjust the --virtual-store-dir configuration or disable the global virtual store to resolve the issue with incorrect dependencies and broken symlinks. This is recommended as it directly addresses the potential cause of the issue and can be easily reverted if necessary.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING