-
Notifications
You must be signed in to change notification settings - Fork 30.3k
Open
Labels
TurbopackRelated to Turbopack with Next.js.Related to Turbopack with Next.js.
Description
Link to the code that reproduces this issue
https://github.com/amannn/nextjs-bug-repro-turbo-alias
To Reproduce
git clone https://github.com/amannn/nextjs-bug-repro-turbo-alias
pnpm install
pnpm run dev
open http://localhost:3000Relevant files:
apps/web/next.config.ts– configuresresolveAliaspackages/wrapper-pkg/dist/index.js– re-exports fromtest-pkg/foopackages/test-pkg/package.json– defines subpath exports./fooand./foo/alt
Current vs. Expected behavior
| Current | Expected | |
|---|---|---|
| Page displays | "original" | "aliased" |
| Module loaded | test-pkg/foo → dist/foo.js |
test-pkg/foo/alt → dist/foo-alt.js |
The alias works correctly when test-pkg is a direct dependency, but fails when it's a transitive dependency (nested in wrapper-pkg/node_modules).
Provide environment information
Operating System:
Platform: darwin
Arch: x64
Version: Darwin Kernel Version 24.6.0: Wed Nov 5 21:30:23 PST 2025; root:xnu-11417.140.69.705.2~1/RELEASE_X86_64
Available memory (MB): 16384
Available CPU cores: 12
Binaries:
Node: 22.21.1
npm: 10.9.4
Yarn: 1.22.22
pnpm: 10.24.0
Relevant Packages:
next: 16.1.1-canary.27 // Latest available version is detected (16.1.1-canary.27).
eslint-config-next: N/A
react: 19.2.3
react-dom: 19.2.3
typescript: 5.9.3
Next.js Config:
output: N/AWhich area(s) are affected? (Select all that apply)
Turbopack
Which stage(s) are affected? (Select all that apply)
next dev (local), next build (local), next start (local)
Additional context
Workaround: use require.resolve() to get the actual file path and convert to a relative path
Metadata
Metadata
Assignees
Labels
TurbopackRelated to Turbopack with Next.js.Related to Turbopack with Next.js.