next-mdx-remote: Unhandled Runtime Error TypeError: Cannot read properties of undefined (reading 'default')
SOURCE CODE.
when even i use MDXRemote component i am getting this error. please let me know how can i fix this.
import { MDXRemote } from "next-mdx-remote";
import { serialize } from "next-mdx-remote/serialize";
const Test = () => <div>TEST</div>;
const components = { Test };
export default function TestPage({ source }) {
return (
<div className="wrapper">
<MDXRemote {...source} components={components} />
</div>
);
}
export async function getStaticProps() {
// MDX text - can be from a local file, database, anywhere
const source = "Some **mdx** text, with a component <Test />";
const mdxSource = await serialize(source);
return { props: { source: mdxSource } };
}
{
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint"
},
"dependencies": {
"@mdx-js/loader": "^2.3.0",
"@mdx-js/react": "^2.3.0",
"@next/mdx": "^13.4.3",
"@types/mdx": "^2.0.5",
"@types/node": "20.2.3",
"@types/react": "18.2.6",
"@types/react-dom": "18.2.4",
"autoprefixer": "10.4.14",
"eslint": "8.41.0",
"eslint-config-next": "13.4.3",
"next": "13.4.3",
"next-mdx-remote": "^4.4.1",
"postcss": "8.4.23",
"react": "18.2.0",
"react-dom": "18.2.0",
"tailwindcss": "3.3.2",
"typescript": "5.0.4"
}
}
Built with “next”: “13.4.3”,
About this issue
- Original URL
- State: open
- Created a year ago
- Reactions: 4
- Comments: 15 (1 by maintainers)
The same issue with nextjs turbo