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

gatsby-mdx deprecated, use gatsby-plugin-mdx instead #27

Closed
JRGould opened this issue Oct 1, 2019 · 3 comments
Closed

gatsby-mdx deprecated, use gatsby-plugin-mdx instead #27

JRGould opened this issue Oct 1, 2019 · 3 comments

Comments

@JRGould
Copy link

JRGould commented Oct 1, 2019

Using gatsby-mdx, gatsby was not picking up .mdx files added to the pages directory but it looks like you can just install gatsby-plugin-mdx and use that in gatsby-config.js with no other modifications.

@denvercoder
Copy link

I talked to @jlengstorf today and he said that using gatsby-plugin-mdx is in the errata for the course.

There is one additional change that I noticed.

in post.js the query should be

export const query = graphql`
  query($slug: String!) {
    mdx(frontmatter: { slug: { eq: $slug } }) {
      frontmatter {
        title
        author
      }
      body
    }
  }
`

Instead of

export const query = graphql`
  query($slug: String!) {
    mdx(frontmatter: { slug: { eq: $slug } }) {
      frontmatter {
        title
        author
      }
      code {
             body
      }
    }
  }
`

@denvercoder
Copy link

For the future generations. I was getting messages in the console:

File not found hello-world
File not found another-post
File not found hello-world
File not found another-post
File not found hello-world
File not found another-post

Every time I would refresh the page I got those messages. I was googling and couldn't find anything so I sat down to carefully check my code against the code in this repo. It was driving me crazy because they matched exactly.

Finally I checked the
package.json
file and found out that I still had the
"gatsby-mdx"
npm package installed.

As soon as I removed it the messages went away.

I (am just assuming) that the gatsby-mdx was creating the messages because it couldn't find any config settings or options in the gatsby-config file.

🤷‍♂

@1Marc 1Marc closed this as completed in 92af4b8 Dec 3, 2019
@1Marc
Copy link
Member

1Marc commented Dec 3, 2019

Added to the course errata. Thanks @denvercoder!

aditya81070 added a commit to aditya81070/gatsby-intro that referenced this issue Dec 27, 2019
* Bump eslint-utils from 1.4.0 to 1.4.2

Bumps [eslint-utils](https://github.com/mysticatea/eslint-utils) from 1.4.0 to 1.4.2.
- [Release notes](https://github.com/mysticatea/eslint-utils/releases)
- [Commits](mysticatea/eslint-utils@v1.4.0...v1.4.2)

Signed-off-by: dependabot[bot] <[email protected]>

* Errata: Unwrap body in the query, fixes FrontendMasters#27

* Add language to code block

* Add code snippets to the errata

* Update the titles for the errata

* Upgrade packages

* Adds CodeSandbox links

* Add notes about codesandbox vs running on your computer

* Updated notes about codesandbox

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Marc Grabanski <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants