AI & Agent Dev Bug Sandbox logo
AI & Agent Dev Bug Sandbox
Back to Radar

Turbopack ResolveAlias Fails To Override Next/Link Even With Matching Tsconfig Paths In Next.Js 16

In Next.js 16 (canary), Turbopack's module resolution does not apply user-defined aliases (from tsconfig paths or resolveAlias) to built-in modules like next/link. As a result, the original Next.js Link is used instead of the custom component, causing unexpected prefetching and missing console logs. This regression worked in Next.js 15 with webpack.

highConfidence 75%Next.jsRoute Handlersnext buildReact Server ComponentsAffected V16.2.0-Canary.80

Origin Analysis

Turbopack's resolver gives priority to internal aliases for next/* modules over user-configured aliases. The built-in mapping is hard-coded and not overridable through tsconfig paths or the resolveAlias option, creating a design flaw where user overrides are silently ignored.
1. Clone https://github.com/parvathi-xflowpay/link-alias 2. Run `yarn install` 3. Run `yarn build` then `yarn start` 4. Open http://localhost:3000/ and open DevTools Console and Network tab 5. Observe that the custom Link component is not used: no console log appears, and a prefetch request is made for the link target despite the custom component setting `prefetch={false}` for external links.

Fixing Code Block

Edge Case Audit

Even with `resolveAlias`, the fix may still fail because Turbopack's internal alias resolution may not be overridable. Forcing webpack fallback (disabling Turbopack) will restore correct behavior but loses Turbopack performance benefits. Additionally, the alias path must be correct and the custom component must be compatible with the `next/link` API (including `legacyBehavior` if needed). For rollback, simply remove the alias configuration and restore original imports. Test thoroughly in production builds, as bundler differences can cause subtle behavioral changes.

Ecosystem Topology

Agent Frameworks

LangChain, LlamaIndex, and Pydantic

  1. highProperty graph relation keys collide when entity IDs or labels contain underscores
  2. highCodeActAgent drops assistant tool-call metadata during handoff, leaving an orphan tool response
  3. high[Bug]: HierarchicalNodeParser async methods return the documents unsplit
  4. highLLM.predict_and_call fails with ValidationError for non-function-calling models when react_chat_formatter is omitted
  5. highAnthropic streaming server-tool input_json_delta overwrites completed client tool_use arguments due to stale cur_tool_call state