vercel / vercel/next.js

[next-rspack] NextExternalsPlugin wrongly externalizes transpilePackages direct dependencies on Windows + pnpm (dev only, pages router)

Open
#98,505 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Runtime
Dominant language
JavaScript
Stars
142k
Forks
32.4k
Avg merge
2d 14h
Merged PRs (30d)
351

Description

Link to the code that reproduces this issue

https://github.com/helloworldcyj/rspack-next-externals-repro

To Reproduce

One-time setup: generates vendor/demo-service-1.0.0.tgz from packages/service
(the tarball is NOT committed to git), then installs dependencies
pnpm bootstrap

① rspack dev (bug scene)
pnpm repro:rspack
Open http://localhost:3100
The page shows: SSR resolve result: FAILED: No matching bindings found for serviceIdentifier: Symbol(Config)

② webpack dev (control group, behaves correctly)
pnpm repro:webpack
The page shows: SSR resolve result: OK, answer = 42

③ rspack production build (also works fine, which shows the issue is dev-mode specific)
pnpm build:rspack

Current vs. Expected behavior

Environment: Windows + pnpm (junctions inside node_modules) + Next.js 16.3.0 + next-rspack 16.3.0 (NEXT_RSPACK=true) + pages router
Expected: both transpile packages are bundled into the pages router server bundle (this is what happens in webpack mode)

Provide environment information
Environment: Windows + pnpm (junctions inside node_modules) + Next.js 16.3.0 + next-rspack 16.3.0 (NEXT_RSPACK=true) + pages router
Which area(s) are affected? (Select all that apply)

Runtime

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

next dev (local)

Additional context

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked rspack-next-externals-repro repository and run pnpm bootstrap followed by pnpm repro:rspack on Windows. Compare the failing pages-router SSR result with pnpm repro:webpack and pnpm build:rspack, then trace how NextExternalsPlugin handles transpilePackages in rspack dev mode. Done means both transpile packages are bundled and the page reports the expected answer.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, next.js, webpack
Domain
backend, build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.