diff --git a/packages/astro/src/jsx/rehype.ts b/packages/astro/src/jsx/rehype.ts index d04bf0d782..d124c9a9f7 100644 --- a/packages/astro/src/jsx/rehype.ts +++ b/packages/astro/src/jsx/rehype.ts @@ -30,7 +30,13 @@ export const rehypeAnalyzeAstroMetadata: RehypePlugin = () => { if (node.type !== 'mdxJsxFlowElement' && node.type !== 'mdxJsxTextElement') return; const tagName = node.name; - if (!tagName || !isComponent(tagName)) return; + if ( + !tagName || + !isComponent(tagName) || + !hasClientDirective(node) || + !hasServerDeferDirective(node) + ) + return; // From this point onwards, `node` is confirmed to be an island component