-
Notifications
You must be signed in to change notification settings - Fork 671
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
v0.15.1: Error: Can't resolve '@mdx-js/react'
in gatsby plugin
#2330
Comments
Hey @fwextensions! Thanks for the issue. Could you check if the I've just added either version of "@mdx-js/react": "^1 || ^2" |
Haven't tried the PR yet, but won't this still require the installation of MDX along with Theme-UI? I thought this in the changelog meant MDX was jno longer required:
I'm not using MDX at all, so wouldn't expect to have to install it if Theme-UI doesn't need it. |
What I'd do in your case, is either "shadow" If I were to use Gatsby shadowing, I'd remove those lines: import { ThemeProvider, merge } from 'theme-ui'
- import { useThemedStylesWithMdx } from '@theme-ui/mdx'
import React from 'react'
import localTheme from './index'
import components from './components'
import useThemeUiConfig from './hooks/configOptions'
- import { MDXProvider, useMDXComponents } from '@mdx-js/react'
const Root = ({ children }) => {
const themeUiConfig = useThemeUiConfig()
const { preset, prismPreset } = themeUiConfig
const theme = preset.default || preset
const themeWithPrism = merge(theme, {
styles: {
pre: prismPreset,
},
})
const fullTheme = merge(themeWithPrism, localTheme)
return (
<ThemeProvider theme={fullTheme}>
- <MDXProvider
- components={useThemedStylesWithMdx(useMDXComponents(components))}
- >
{children}
- </MDXProvider>
</ThemeProvider>
)
}
export const WrapRootElement = ({ element }) => {
return <Root>{element}</Root>
} |
Describe the bug
Upgraded from 0.14.7 to 0.15.1, did a fresh install with
npm i
, and now runninggatsby develop
fails with an error:To Reproduce
Steps to reproduce the behavior:
Deps list in the package:
Expected behavior
My project is no longer using MDX, and I removed imports of
Themed
, so it's surprising to see@mdx-js
being required.Additional context
I see
"@mdx-js/react": "^1"
as a dev dependency in the plugin package, but maybe that should be a peer? Also if it is a dependency, seems strange that it's not getting installed by npm automatically.I can manually add
@mdx-js/react
to package.json to get the gatsby build to work, but then I'm back to forcing the install because of React 18, which Theme-UI now requires but isn't supported by mdx v1.The text was updated successfully, but these errors were encountered: