-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Rendering <Content /> fails for MDX file containing <Fragment> #5519
Copy link
Copy link
Closed
Description
What version of astro are you using?
1.6.12
Are you using an SSR adapter? If so, which one?
n/a
What package manager are you using?
npm
What operating system are you using?
macOS / Stackblitz
Describe the Bug
(Ran into this bug as part of migrating docs to MDX and it’s a bit of blocker given how much we use <Fragment> to pass content to slots.)
-
MDX supports using
<Fragment>, which can be useful for example to pass stuff to a named slot:<Component> <Fragment slot="box">Box content</Fragment> </Component>
This renders fine for an MDX page, e.g.
src/pages/index.mdx. -
If you import (or glob) the same page and use it’s
<Content />component however:--- import { Content } from './index.mdx'; --- <Content />
Astro will throw an error:
Expected component `Fragment` to be defined: you likely forgot to import, pass, or provide it.
I guess somewhere <Fragment> support is being wired up when a page is rendered but that same wiring is missing for the <Content /> render.
Link to Minimal Reproducible Example
https://stackblitz.com/edit/github-zq6zwz?file=src/pages/index.mdx
Participation
- I am willing to submit a pull request for this issue.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels