mirror of
https://github.com/hanzoai/next.js.git
synced 2026-10-30 14:46:38 +00:00
### What? Provide a fallback for the `mdx-components` file. ### Why? Given a user uses the Next.js app directory, and doesn’t have an `mdx-components` file; 1. If the user has `@mdx-js/react` installed, Next.js shows a cryptic error message, stating only client components may use React context. 2. If the user doesn’t have `@mdx-js/react` installed, Next.js shows a cryptic error message, stating `next-mdx-import-source-file` could not be resolved. ### How? This fixes 2 by providing a fallback. I suggest fixing 1, by completely removing all references to `@mdx-js/react` from the project. --------- Co-authored-by: JJ Kasper <[email protected]>
16 lines
257 B
JavaScript
16 lines
257 B
JavaScript
import nextMDX from '@next/mdx'
|
|
|
|
const withMDX = nextMDX()
|
|
|
|
/**
|
|
* @type {import('next').NextConfig}
|
|
*/
|
|
const nextConfig = {
|
|
pageExtensions: ['js', 'jsx', 'ts', 'tsx', 'mdx'],
|
|
experimental: {
|
|
mdxRs: true,
|
|
},
|
|
}
|
|
|
|
export default withMDX(nextConfig)
|