We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Hi there. I'm using this version: "next-mdx-remote": "^3.0.8"
"next-mdx-remote": "^3.0.8"
I'm trying to import a component directly into my .mdx file like so:
import LeagueWithTeam from '../components/LeagueWithTeam'; <Fragment> <LeagueWithTeam region={region} lng={lng} /> </Fragment>
The file components/LeagueWithTeam.tsx looks roughly like this:
components/LeagueWithTeam.tsx
import React from 'react' const LeagueWithTeam = () => {...} export default LeagueWithTeam
But when I build this I get the following error: Component LeagueWithTeam was not imported, exported, or provided by MDXProvider as global scope
Component LeagueWithTeam was not imported, exported, or provided by MDXProvider as global scope
Is it not possible to import components directly into MDX files?
The text was updated successfully, but these errors were encountered:
Not with this package implementation.
We have to pass components through <MDXRemote>, like this:
<MDXRemote>
import LeagueWithTeam from "components/LeagueWithTeam" export const components = {LeagueWithTeam} export default function Page() { return ( <MDXRemote components={components} /> ) }
This is outlined in the package Readme.
Sorry, something went wrong.
As mentioned above, imports are not supported in next-mdx-remote as we treat the content as data, so resolving imports is a non-trivial problem.
next-mdx-remote
related to #48 #143
No branches or pull requests
Hi there.
I'm using this version:
"next-mdx-remote": "^3.0.8"
I'm trying to import a component directly into my .mdx file like so:
The file
components/LeagueWithTeam.tsx
looks roughly like this:But when I build this I get the following error:
Component LeagueWithTeam was not imported, exported, or provided by MDXProvider as global scope
Is it not possible to import components directly into MDX files?
The text was updated successfully, but these errors were encountered: