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

Module build failed with all versions of gatsby-plugin-mdx supporting MDX v2 #37048

Closed
2 tasks done
csouchet opened this issue Nov 16, 2022 · 3 comments
Closed
2 tasks done
Labels
topic: remark/mdx Related to Markdown, remark & MDX ecosystem type: bug An issue or pull request relating to a bug in Gatsby

Comments

@csouchet
Copy link

Preliminary Checks

Description

I use mdx in my project to generate some parts of a page and not to generate one page by .mdx file.

Since the first version of gatsby-plugin-mdx who support MDX v2, I tried to migrate from 3.20.0 of gatsby-plugin-mdx to a more recent version. (I tested all the new versions until the 5.0.0)
But I have always the same error:

Module build failed (from ./node_modules/gatsby/dist/utils/babel-loader.js):
SyntaxError: /src/content/content_3.mdx: Missing semicolon. (1:3)

> 1 | You can create and build applications to visualize:```

Reproduction Link

https://codesandbox.io/s/gatsby-plugin-mdx-4-3-0-failed-5i4eud

Steps to Reproduce

  1. npm i
  2. npm run develop or npm run build

Expected Result

No error, and this rendering for the main page : https://codesandbox.io/s/gatsby-plugin-mdx-3-20-0-ok-swrtm0

Actual Result

We have the following error on all .mdx files:

Module build failed (from ./node_modules/gatsby/dist/utils/babel-loader.js):
SyntaxError: /src/content/content_3.mdx: Missing semicolon. (1:3)

> 1 | You can create and build applications to visualize:```

Environment

System:
    OS: macOS 12.6
    CPU: (12) x64 Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 18.12.1 - ~/.nvm/versions/node/v18.12.1/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 8.19.2 - ~/.nvm/versions/node/v18.12.1/bin/npm
  Browsers:
    Chrome: 107.0.5304.110
    Firefox: 106.0.5
    Safari: 16.1
  npmPackages:
    gatsby: ^5.0.1 => 5.0.1
    gatsby-plugin-google-gtag: ^5.0.0 => 5.0.0
    gatsby-plugin-mailchimp: ^5.2.2 => 5.2.2
    gatsby-plugin-manifest: ^5.0.0 => 5.0.0
    gatsby-plugin-material-ui: ^4.1.0 => 4.1.0
    gatsby-plugin-mdx: ^5.0.0 => 5.0.0
    gatsby-plugin-robots-txt: ^1.8.0 => 1.8.0
    gatsby-plugin-sitemap: ^5.24.0 => 5.24.0
    gatsby-plugin-styled-components: ^6.0.0 => 6.0.0
    gatsby-plugin-typescript: ^5.0.0 => 5.0.0
    gatsby-remark-responsive-iframe: ^6.0.0 => 6.0.0
    gatsby-source-filesystem: ^5.0.0 => 5.0.0
    gatsby-transformer-remark: ^6.0.0 => 6.0.0

Config Flags

No response

@csouchet csouchet added the type: bug An issue or pull request relating to a bug in Gatsby label Nov 16, 2022
@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Nov 16, 2022
@LekoArts LekoArts added topic: remark/mdx Related to Markdown, remark & MDX ecosystem and removed status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer labels Nov 23, 2022
@LekoArts
Copy link
Contributor

LekoArts commented Nov 23, 2022

Hi!

As pointed out in the README (https://www.gatsbyjs.com/plugins/gatsby-plugin-mdx/#usage) you'll need to configure gatsby-source-filesystem to ingest your MDX files.

When you add this to your gatsby-config your reproduction will work:

{
  resolve: `gatsby-source-filesystem`,
  options: {
    name: `content`,
    path: `${__dirname}/src/content`
  }
}

@csouchet
Copy link
Author

Hi @LekoArts !

Firstly, thank you for your answer.

I had followed the migration doc, but I didn't quite understand that part.
Thanks a lot for the solution 🙂

Have a good day

@LekoArts
Copy link
Contributor

#37088 will hopefully make that clearer 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: remark/mdx Related to Markdown, remark & MDX ecosystem type: bug An issue or pull request relating to a bug in Gatsby
Projects
None yet
Development

No branches or pull requests

2 participants