JavaScript for WordPress Forums Bugs & Issues Gatsby Basics: gatsby-mdx is depreciated, use gatsby-plugin-mdx instead

This topic contains 1 reply, has 2 voices, and was last updated by  Zac Gordon 6 days, 23 hours ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #117588

    Stuart
    Participant

    Hi Zac,

    Unfortunately your video on the Gatsby Basics course Creating Content with Markdown (MDX) is now out of date because gatsby-mdx is depreciated.

    I managed to switch to using gatsby-plugin-mdx and it works fine, also the video is a lot longer than 5:03 🙂

    This error also effects the next video Creating Dynamic Page Templates. There is no longer a code object in mdx, only body and when I try to code along as per the instructions I get an error:

    ERROR #85907 GRAPHQL

    There was an error in your GraphQL query:

    – Unknown field ‘code’ on type ‘Mdx’.

    To fix this you have to do:

    query MyQuery($slug: String!) {
    mdx(frontmatter: { slug: { eq: $slug } }) {
    frontmatter {
    title
    }
    body
    }
    }

    and

    export default ({
    data: {
    mdx: {
    frontmatter: { title },
    body: content,
    },
    },
    }) => (
    <Layout>
    <h1>{title}</h1>
    <MDXRenderer>{content}</MDXRenderer>
    </Layout>
    )

    Now I get the post body showing 🙂

    #117589

    Zac Gordon
    Keymaster

    Thanks for the ping! Actually update this in a later video, but will link to this from the video!

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.