Link to the code that reproduces this issue
https://github.com/timheerwagen/next-standalone-pnpm-symlink-repro
To Reproduce
pnpm install
pnpm build
pnpm test - The script shows the resolved path of the standalone Next Node module.
Current vs. Expected behavior
When using Next.js with output: "standalone" together with pnpm, the generated standalone output contains symlinks inside .next/standalone/node_modules that resolve to the root node_modules/.pnpm dir instead of the .next/standalone/node_modules/.pnpm directory.
Provide environment information
Operating System:
Platform: win32
Arch: x64
Version: Windows 11 Home
Available memory (MB): 16294
Available CPU cores: 12
Binaries:
Node: 24.11.1
npm: 11.16.0
Yarn: N/A
pnpm: 10.23.0
Relevant Packages:
next: 16.2.10 // Latest available version is detected (16.2.10).
eslint-config-next: N/A
react: 19.2.7
react-dom: 19.2.7
typescript: N/A
Next.js Config:
output: standalone
Which area(s) are affected? (Select all that apply)
Module Resolution
Which stage(s) are affected? (Select all that apply)
next build (local)
Additional context
This behaviour only occurs on Windows and not on Linux, as demonstrated here: https://github.com/timheerwagen/next-standalone-pnpm-symlink-repro/actions/runs/28657904104/job/84991341147.
Link to the code that reproduces this issue
https://github.com/timheerwagen/next-standalone-pnpm-symlink-repro
To Reproduce
pnpm installpnpm buildpnpm test- The script shows the resolved path of the standalone Next Node module.Current vs. Expected behavior
When using Next.js with output: "standalone" together with pnpm, the generated standalone output contains symlinks inside
.next/standalone/node_modulesthat resolve to the rootnode_modules/.pnpmdir instead of the.next/standalone/node_modules/.pnpmdirectory.Provide environment information
Which area(s) are affected? (Select all that apply)
Module Resolution
Which stage(s) are affected? (Select all that apply)
next build (local)
Additional context
This behaviour only occurs on Windows and not on Linux, as demonstrated here: https://github.com/timheerwagen/next-standalone-pnpm-symlink-repro/actions/runs/28657904104/job/84991341147.