-
Notifications
You must be signed in to change notification settings - Fork 100
SyntaxError: unknown: Identifier '_frontmatter' has already been declared #354
Comments
MDX 1.0 changed the default // gatsby-browser.js
import React from "react"
import { MDXProvider } from "@mdx-js/react"
const components = {
wrapper: ({children}) => <>{children}</>
}
export const wrapRootElement = ({ element }) => {
return (
<MDXProvider components={components}>
{element}
</MDXProvider>
)
}
|
wait, I think I misread this. already declared is a different issue. I know what's happening, hang on. |
So it's a default/expectation that all projects using |
Also I just realized removing |
@derekr still working out what gatsby-mdx's recommendation should be there. It's possible that we could solve it at the library level instead and not have to tell anyone to do anything. In the meantime, yeah it's expected that if you run into this issue you'd replace the wrapper in your own project. |
My guess is that this is related to having multiple gatsby-mdx plugins. We could ask @jxnblk to add an option to disable the one in the theme as a short-term fix. In the long-term this needs to be solved on either the Gatsby level (allowing plugins to determine how many instances they are allowed to have and how to merge the options) or on the gatsby-mdx level, if we can figure out how to ensure that multiple instances of gatsby-mdx can coexist. |
On it 🕵🏻♂️jxnblk/mdx-deck#325 |
So fast!!! Y'all are amazing. This is like the dream setup now. Confirmed fix on my end. |
cool, going to close this here then :) |
Still seeing this occur. Installed gatsby-plugin-mdx in the default starter and got this message (after
...followed by a host of other messages such as:
So what is the official fix now? |
I'm getting that error any time I try to specify a layout in |
Same here… @ChristopherBiscardi, any guidance? |
Fixed the issue I was having: the @ChristopherBiscardi, this project is so helpful—thanks for your work on it and for your involvement with Gatsby in general. |
I’m hitting this error now using Is there a pattern available to support this, or should I try to figure something else out? |
I'm getting this error also when trying to use 3 different themes that use MDX. gatsby-theme-notes (official gatsby theme) Does anyone have a fix or workaround?? |
Right now you can configure the themes to only configure MDX like so: // gatsby-config.js
module.exports = {
plugins: [
{
resolve: 'gatsby-theme-notes',
options: {
mdx: false
}
},
{
resolve: 'gatsby-theme-blog',
options: {
mdx: false
}
},
'gatsby-theme-documentation'
]
} We know this isn't an ideal situation and will be working on making the composition story with |
Describe the bug
Parsing any
mdx
files insrc/pages
causes this parsing error duringgatsby develop
.To Reproduce
https://codesandbox.io/s/pj1k8r410j
gatsby develop
Expected behavior
Build should succeed and dev server is running.
Screenshots
The text was updated successfully, but these errors were encountered: