Skip to content

Docs state that next.config.ts is supported for both pages and app dir docs but next dev errors #70513

@Ziothh

Description

@Ziothh

Link to the code that reproduces this issue

https://github.com/Ziothh/next-config-ts-example

To Reproduce

Just start a fresh nextjs project and convert the next.config.js file to next.config.ts and use ESModule import syntax.

Current vs. Expected behavior

Expected behavior

Docs state that there is Typescript support but next dev throws an error.

Docs for specific routers:

Actual behavior

Error printed to console:

$ pnpm dev

> [email protected] dev /Users/zioth/funkey/i18n-playground
> next dev

/Users/zioth/funkey/i18n-playground/node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/next/dist/server/config.js:787
            throw new Error(`Configuring Next.js via '${(0, _path.basename)(nonJsPath)}' is not supported. Please replace the file with 'next.config.js' or 'next.config.mjs'.`);
                  ^

Error: Configuring Next.js via 'next.config.ts' is not supported. Please replace the file with 'next.config.js' or 'next.config.mjs'.
    at loadConfig (/Users/zioth/funkey/i18n-playground/node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/next/dist/server/config.js:787:19)
    at async Module.nextDev (/Users/zioth/funkey/i18n-playground/node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/next/dist/cli/next-dev.js:175:14)

Node.js v20.9.0
 ELIFECYCLE  Command failed with exit code 1.

Provide environment information

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 23.4.0: Fri Mar 15 00:19:22 PDT 2024; root:xnu-10063.101.17~1/RELEASE_ARM64_T8112
  Available memory (MB): 16384
  Available CPU cores: 8
Binaries:
  Node: 20.9.0
  npm: 10.1.0
  Yarn: N/A
  pnpm: 8.8.0
Relevant Packages:
  next: 14.2.13 // Latest available version is detected (14.2.13).
  eslint-config-next: 14.2.13
  react: 18.3.1
  react-dom: 18.3.1
  typescript: 5.6.2
Next.js Config:
  output: N/A

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

Documentation

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

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

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    DocumentationRelated to Next.js' official documentation.bugIssue was opened via the bug report template.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions