vercel / vercel/next.js

`next.config.ts` breaks when using import aliases

Open
#74,140 4 comments 7 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

TypeScript
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/Larsv94/tsconfig-alias-import-repro

To Reproduce
  1. Start the application in development (next dev) or build the application (next build)
Current vs. Expected behavior

When building or starting the application with next dev the commands fail with "Error: Cannot find module './src/config/utils/someUtils'" because of someConfig.ts import someUtils.ts via an import alias.

It does work when someConfig.ts uses a relative import (included in example)

Expect import aliases to work as well

Provide environment information
Operating System:
  Platform: win32
  Arch: x64
  Version: Windows 11 Pro
  Available memory (MB): 32476
  Available CPU cores: 28
Binaries:
  Node: 20.18.1
  npm: 10.8.2
  Yarn: 4.5.3
  pnpm: N/A
Relevant Packages:
  next: 15.1.2 // Latest available version is detected (15.1.2).
  eslint-config-next: 15.1.2
  react: 19.0.0
  react-dom: 19.0.0
  typescript: 5.7.2
Next.js Config:
  output: N/A
Which area(s) are affected? (Select all that apply)

Developer Experience, TypeScript

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

next dev (local), next build (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 reproduction and inspect next.config.ts, someConfig.ts, and someUtils.ts, then run next dev and next build to reproduce the alias failure. Done means both commands resolve the aliased import successfully while the relative-import case continues to work.

Written by the indexing model from the issue text.

Assessment

Tech stack
next.js, typescript
Domain
build-system, developer-experience
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.