-
How to make the compiler work for React Server Components? I'm using Next.js 13's new Right now, with this (and some This is a test **Markdown** file async function getContent() {
const rawContent = await import(`./test.mdx`).then(x => x.default);
return rawContent;
}
export default async function Page() {
const content = await getContent();
return <div>{content}</div> /* not parsing yet for inspection purposes */;
} I can get the Markdown file to be displayed raw: But when I add the compiler in, import { compile } from "@mdx-js/mdx";
async function getContent() {
const rawContent = await import(`./test.mdx`).then(x => x.default);
const content = String(await compile(rawContent, { outputFormat: "function-body" }));
return content;
}
export default async function Page() {
const content = await getContent();
return <div>{content}</div> /* not parsing yet for inspection purposes */;
} a very mysterious error message appears: How to resolve this error and use the compiler in React Server Components in general? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 10 replies
-
I think this is about Rich-Harris/periscopic#10, which was solved more than a year ago. I’m guessing you are not using the latest |
Beta Was this translation helpful? Give feedback.
I think this is about Rich-Harris/periscopic#10, which was solved more than a year ago. I’m guessing you are not using the latest
@mdx-js/mdx
.