MDX: fix compatibility issues with Vite RSC

This commit is contained in:
Fuma Nama
2026-05-10 16:56:19 +08:00
parent 3b3083e1e6
commit 298ac97867
2 changed files with 10 additions and 0 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'fumadocs-mdx': patch
---
fix compatibility issues with Vite RSC
+5
View File
@@ -96,6 +96,11 @@ export default async function mdx(
});
},
async transform(value, id) {
// Vite RSC will pass the compiled MDX file's client module with ID `virtual:vite-rsc/client-references/group/facade:xxx.mdx`.
// The format of `value` becomes JavaScript, which will break the MDX compiler.
// We have to ignore them.
if (id.includes('virtual:vite-rsc')) return null;
try {
if (metaLoader.filter(id)) {
return await metaLoader.transform.call(this, value, id);