Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(gatsby-plugin-mdx): Add React import when not defined #36595

Merged
merged 4 commits into from
Sep 13, 2022

Conversation

LekoArts
Copy link
Contributor

Description

When updating a site/theme of mine, I've run into a problem:

React is not defined

Because it used this without importing React

export default function GatsbyMDXWrapper(props) {
  return React.createElement(MDXContent, props, React.createElement(GATSBY_COMPILED_MDX, props));
}

Related Issues

[ch54694]

@LekoArts LekoArts added the topic: remark/mdx Related to Markdown, remark & MDX ecosystem label Sep 12, 2022
@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Sep 12, 2022
@LekoArts LekoArts removed the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Sep 12, 2022
@@ -137,7 +145,7 @@ const gatsbyLayoutLoader: LoaderDefinition = async function (
type: `Identifier`,
name: `GatsbyMDXWrapper`,
},
expression: true,
expression: false,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When browsing AST explorer the examples I provided always had this to false

wardpeet
wardpeet previously approved these changes Sep 12, 2022
@LekoArts LekoArts added the bot: merge on green Gatsbot will merge these PRs automatically when all tests passes label Sep 12, 2022
@LekoArts LekoArts merged commit 34df27a into master Sep 13, 2022
@LekoArts LekoArts deleted the mdx-v2-react-import-error branch September 13, 2022 05:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bot: merge on green Gatsbot will merge these PRs automatically when all tests passes topic: remark/mdx Related to Markdown, remark & MDX ecosystem
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants