Skip to content

Commit

Permalink
docs: module resolution for next.config.ts is currently limited to …
Browse files Browse the repository at this point in the history
…`CommonJS` (#71162)

### Why?

In current state, `next.config.ts` cannot resolve Native ESM syntax.
Therefore it may import extensions `.js`, `.mjs`, `.cjs`, it will throw
when the imported module uses Native ESM syntax like top-level await.

Closes NDX-368

---------

Co-authored-by: JJ Kasper <[email protected]>
  • Loading branch information
devjiwonchoi and ijjk authored Oct 14, 2024
1 parent 719de07 commit d6b932d
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ const nextConfig: NextConfig = {
export default nextConfig
```

> **Good to know**: You can import Native ESM modules in `next.config.ts` without any additional configuration. Supports importing extensions like `.cjs`, `.cts`, `.mjs`, and `.mts`.
> **Note**: Module resolution in `next.config.ts` is currently limited to `CommonJS`. This may cause incompatibilities with ESM only packages being loaded in `next.config.ts`.
<AppOnly>

Expand Down

0 comments on commit d6b932d

Please sign in to comment.