Skip to content

🐛 BUG: <Fragment> breaks MDX files #4130

@delucis

Description

@delucis

What version of astro are you using?

v1.0.0-rc.4

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

Using <Fragment> in an MDX file causes an error:

Unable to render MDXContent!

There is 1 renderer configured in your `astro.config.mjs` file,
but it was not able to server-side render MDXContent.

Did you mean to enable `@astrojs/react`, `@astrojs/preact`, `@astrojs/vue` or `@astrojs/svelte`?

My use case is an Astro component with named slots where you want to target a slot without adding a wrapper element:

<ComponentWithSlots>
  <Fragment slot="title">Text node</Fragment>
</ComponentWithSlots>

But the bug is not limited to named slots — any use of <Fragment> will trigger this error.

Notably the shorthand <></> syntax is supported, but that won’t allow specifying a named slot.

Link to Minimal Reproducible Example

https://stackblitz.com/edit/github-1fshkh?file=src/pages/index.mdx

Participation

  • I am willing to submit a pull request for this issue.

Metadata

Metadata

Assignees

Labels

- P3: minor bugAn edge case that only affects very specific usage (priority)pkg: mdxIssues pertaining to `@astrojs/mdx` integration

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions