vercel / next.js

The React Framework
https://nextjs.org
MIT License
124.68k stars 26.61k forks source link

next.config.ts does not support top-level-await #67765

Open stefanprobst opened 1 month ago

stefanprobst commented 1 month ago

Link to the code that reproduces this issue

https://github.com/stefanprobst/issue-next.config.ts-await

To Reproduce

ReferenceError: await is not defined

Current vs. Expected behavior

top-level await works in next.config.js but not in next.config.ts.

Provide environment information

Operating System:
  Platform: linux
  Arch: x64
  Version: #41~22.04.2-Ubuntu SMP PREEMPT_DYNAMIC Mon Jun  3 11:32:55 UTC 2
  Available memory (MB): 15893
  Available CPU cores: 4
Binaries:
  Node: 20.14.0
  npm: 10.7.0
  Yarn: N/A
  pnpm: 9.5.0
Relevant Packages:
  next: 15.0.0-canary.67 // Latest available version is detected (15.0.0-canary.67).
  eslint-config-next: N/A
  react: 19.0.0-rc.0
  react-dom: 19.0.0-rc.0
  typescript: 5.5.3
Next.js Config:
  output: N/A

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

TypeScript

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

next dev (local)

Additional context

No response

devjiwonchoi commented 1 month ago

Thank you for reporting this! We will surely get this fixed before going stable. Thank you once again!