fuma-nama / fumadocs

The beautiful docs framework with Next.js. Alternative to Nextra
https://fumadocs.vercel.app
MIT License
1.85k stars 112 forks source link

[bug] support for `next.config.ts` #1054

Open mehdibha opened 1 day ago

mehdibha commented 1 day ago

To Reproduce

When i've switch to next.config.ts, i had this error:


> www@0.1.0 dev C:\Users\mehdi\OneDrive\Bureau\dotUI\www
> next dev --turbo

node:internal/errors:497
    ErrorCaptureStackTrace(err);
    ^

Error: Package subpath './next' is not defined by "exports" in C:\Users\mehdi\OneDrive\Bureau\dotUI\www\node_modules\fumadocs-mdx\package.json
    at new NodeError (node:internal/errors:406:5)
    at exportsNotFound (node:internal/modules/esm/resolve:268:10)
    at packageExportsResolve (node:internal/modules/esm/resolve:542:13)
    at resolveExports (node:internal/modules/cjs/loader:547:36)  
    at Module._findPath (node:internal/modules/cjs/loader:621:31)
    at Module._resolveFilename (node:internal/modules/cjs/loader:1034:27)
    at C:\Users\mehdi\OneDrive\Bureau\dotUI\node_modules\.pnpm\next@15.0.3_react-dom@19.0.0-rc-66855b96-20241106_react@19.0.0-rc-66855b96-20241106__react@19.0.0-rc-66855b96-20241106\node_modules\next\dist\server\require-hook.js:55:36
    at Module._load (node:internal/modules/cjs/loader:901:27)    
    at Module.require (node:internal/modules/cjs/loader:1115:19) 
    at mod.require (C:\Users\mehdi\OneDrive\Bureau\dotUI\node_modules\.pnpm\next@15.0.3_react-dom@19.0.0-rc-66855b96-20241106_react@19.0.0-rc-66855b96-20241106__react@19.0.0-rc-66855b96-20241106\node_modules\next\dist\server\require-hook.js:65:28) {
  code: 'ERR_PACKAGE_PATH_NOT_EXPORTED'
}

Node.js v20.9.0

Current vs. Expected behavior

The project should start correctly when running development server.

Provide environment information

Node.js 20.9
Next.js 15.0.3

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

Content Sources (e.g. Fumadocs MDX, Content Collections)

Additional context

No response

fuma-nama commented 1 day ago

You can try to rename it to next.config.mts

I remember Next.js doesn't support mts extensions, causing ESM packages to have problems so you still need to use mjs. Not sure if it's supported now.