-
Notifications
You must be signed in to change notification settings - Fork 30.1k
Closed
Labels
DocumentationRelated to Next.js' official documentation.Related to Next.js' official documentation.bugIssue was opened via the bug report template.Issue was opened via the bug report template.
Description
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/AWhich 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
samcx
Metadata
Metadata
Assignees
Labels
DocumentationRelated to Next.js' official documentation.Related to Next.js' official documentation.bugIssue was opened via the bug report template.Issue was opened via the bug report template.