diff --git a/packages/mdx/lib/plugin/recma-jsx-rewrite.js b/packages/mdx/lib/plugin/recma-jsx-rewrite.js index a449a9f51..d08279f6f 100644 --- a/packages/mdx/lib/plugin/recma-jsx-rewrite.js +++ b/packages/mdx/lib/plugin/recma-jsx-rewrite.js @@ -145,6 +145,7 @@ export function recmaJsxRewrite(options = {}) { const parentNode = parentScope && parentScope.node if ( !isInScope || + // If the parent is a _createMdxContent function, it's a top-level component in MDX. (parentNode && parentNode.type === 'FunctionDeclaration' && isNamedFunction(parentNode, '_createMdxContent'))