You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We are working on package update to pull in some bug fixes across our dependencies. I ran an npm update and gatsby updated from 2.22.15 to 2.24.62, and the plugin in question (gatsby-plugin-mdx) updated from 1.2.13 to 1.2.40.
After this update, our build failed with the following error:
error "gatsby-plugin-mdx" threw an error while running the onCreateNode lifecycle:
Unexpected character `!` (U+0021) before name, expected a character that can start a name, such as a letter, `$`, or `_`/home/travis/build/datapower/datapower-operator-doc/src/pages/getting-started/index.mdx: Unexpected character `!` (U+0021) before name, expected a character that can start a name, such as a letter, `$`, or `_`
Looking at this particular index.mdx file, the only existence of a ! character that I can find is within a comment block, i.e.:
<!--comment-->
I'm guessing that this is what's triggering the failure, but I don't understand why this would be invalid. Checking current Gatsby MDX documentation there are examples of this same comment syntax.
Steps to reproduce
I tried to reproduce this using the How to Make a Minimal Reproduction repo, but I was not able to reproduce the issue. Here's my commit showing the diff of what I added (and this works as far as I can tell):
I was able to resolve this build issue by taking the following steps:
Revert changes to package.json and package-lock.json (essentially reverting my previous npm update)
rm -rf node_modules
npm ci
Upgrade gatsby-theme-carbon to 1.26.10 (this step also updated gatsby-plugin-mdx to 1.2.40)
npm run build (logs from gatsby build showed that plugin changes were detected, and caches were cleaned to rebuild)
npm update (this updated gatsby to 2.24.63)
npm run build
I'm not quite sure why the order of operations here mattered, but my issue is resolved and this does not appear to be a bug in the gatsby-plugin-mdx plugin itself. Closing.
I found this issue and similar ones with gatsby-plugin-mdx when upgrading, especially with yarn upgrade-interactive.
If you end up with multiple version of the plugin, you might have multiple versions of @mdx-js/react as well. As the React implementation uses a global context, you might end up doubling it. This can happen in combination with theme-ui and react-i18next as well.
Description
We are working on package update to pull in some bug fixes across our dependencies. I ran an
npm update
andgatsby
updated from2.22.15
to2.24.62
, and the plugin in question (gatsby-plugin-mdx
) updated from1.2.13
to1.2.40
.After this update, our build failed with the following error:
Looking at this particular
index.mdx
file, the only existence of a!
character that I can find is within a comment block, i.e.:I'm guessing that this is what's triggering the failure, but I don't understand why this would be invalid. Checking current Gatsby MDX documentation there are examples of this same comment syntax.
Steps to reproduce
I tried to reproduce this using the How to Make a Minimal Reproduction repo, but I was not able to reproduce the issue. Here's my commit showing the diff of what I added (and this works as far as I can tell):
aharbis/gatsby-bug-repro@26b5eb8
npm run build
passes on this repo, and I've confirmed thepackage-lock.json
shows1.2.40
for thegatsby-plugin-mdx
package.So, since the minimal repro isn't showing the issue, I might as well share the actual code that is? 🤷♂️
Since it's MDX, kind of hard to permalink the line, so here's a blame link at the line that I suspect is causing the issue:
https://github.com/IBM/datapower-operator-doc/blame/master/src/pages/getting-started/index.mdx#L19
Expected result
Comment syntax
<!-- comment -->
works in MDX.Actual result
Comment syntax
<!-- comment -->
breaks in MDX.Environment
The text was updated successfully, but these errors were encountered: