allow importing "server-only" modules in next.config.js
#65652
Labels
bug
Issue was opened via the bug report template.
Module Resolution
Module resolution (CJS / ESM, module resolving)
Link to the code that reproduces this issue
https://github.com/stefanprobst/issue-next-config-server-import
To Reproduce
pnpm install
pnpm run dev
Current vs. Expected behavior
i am trying to import a module which has
import "server-only";
intonext.config.js
and get the following error:i had assumed that
next.config.js
would not be read client side.i also checked whether
next.config.js
is actually read client-side by adding the following code innext.config.js
(and everything still worked, so i guess importing fromserver-only
modules should be ok):Provide environment information
Operating System: Platform: linux Arch: x64 Version: #202403151937 SMP PREEMPT_DYNAMIC Fri Mar 15 19:52:22 UTC 2024 Available memory (MB): 31401 Available CPU cores: 16 Binaries: Node: 20.12.2 npm: 10.5.0 Yarn: 1.22.19 pnpm: 9.0.6 Relevant Packages: next: 14.3.0-canary.57 // Latest available version is detected (14.3.0-canary.57). eslint-config-next: N/A react: 18.3.1 react-dom: 18.3.1 typescript: 5.4.5 Next.js Config: output: N/A
Which area(s) are affected? (Select all that apply)
Module Resolution
Which stage(s) are affected? (Select all that apply)
next dev (local)
Additional context
also see this discussion: #65605 (comment)
The text was updated successfully, but these errors were encountered: