nextjs - 💡(How to fix) Fix turbopack.resolveAlias fails to override next/link even with matching tsconfig paths in Next.js 16 [3 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#90929Fetched 2026-04-08 00:19:12
View on GitHub
Comments
3
Participants
3
Timeline
10
Reactions
0
Timeline (top)
commented ×3labeled ×2subscribed ×2comment_deleted ×1

Code Example

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 25.3.0: Wed Jan 28 20:48:41 PST 2026; root:xnu-12377.81.4~5/RELEASE_ARM64_T6041
  Available memory (MB): 24576
  Available CPU cores: 14
Binaries:
  Node: 20.19.6
  npm: 10.8.2
  Yarn: 1.22.22
  pnpm: N/A
Relevant Packages:
  next: 16.2.0-canary.80 // Latest available version is detected (16.2.0-canary.80).
  eslint-config-next: N/A
  react: 19.2.4
  react-dom: 19.2.4
  typescript: 5.9.3
Next.js Config:
  output: N/A
RAW_BUFFERClick to expand / collapse

Link to the code that reproduces this issue

https://github.com/parvathi-xflowpay/link-alias

To Reproduce

Clone this repo and install (yarn install) Build then start (yarn build then yarn start) Open http://localhost:3000/ Open browser DevTools → Console and Network tab

Current vs. Expected behavior

Expected behavior (if alias were applied) The import next/link resolves to src/components/Link.tsx, so the custom Link runs. Console: log "using custom link: /about undefined" (or similar) appears. Prefetch: the custom Link disables prefetch when target="_blank", so no prefetch request for the linked page.

Actual behavior a) Prefetch still happens — e.g. in Network tab you see prefetch for the link target, even though the custom Link would set prefetch={false} for target="_blank". So the built-in Link is being used. b) No log — "using custom link: ..." never appears in the console. The custom component is not used. Conclusion: the bundler is not applying resolveAlias for next/link; the original Next.js Link is still used.

Provide environment information

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 25.3.0: Wed Jan 28 20:48:41 PST 2026; root:xnu-12377.81.4~5/RELEASE_ARM64_T6041
  Available memory (MB): 24576
  Available CPU cores: 14
Binaries:
  Node: 20.19.6
  npm: 10.8.2
  Yarn: 1.22.22
  pnpm: N/A
Relevant Packages:
  next: 16.2.0-canary.80 // Latest available version is detected (16.2.0-canary.80).
  eslint-config-next: N/A
  react: 19.2.4
  react-dom: 19.2.4
  typescript: 5.9.3
Next.js Config:
  output: N/A

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

Module Resolution, Not sure

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

Vercel (Deployed), next dev (local), next start (local)

Additional context

This aliasing behavior worked in Next.js 15, where next/link correctly resolved to the custom component using the tsconfig paths

extent analysis

Fix: Explicit Webpack alias for next/link

Next 16’s new Turbopack compiler no longer respects tsconfig.jsonpaths for built‑in packages.
Add a Webpack alias (which Turbopack also reads) that points next/link to your custom component.

1️⃣ Add/Update next.config.js

// next.config.js
const path = require('node:path');

module.exports = {
  // keep any existing

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

nextjs - 💡(How to fix) Fix turbopack.resolveAlias fails to override next/link even with matching tsconfig paths in Next.js 16 [3 comments, 3 participants]