Skip to content

Astro v6 <style tags in .astro components are not correctly rendered in .mdx files. #15681

@alexmherrmann

Description

@alexmherrmann

Astro Info

Astro                    v6.0.0-beta.17
Vite                     v7.3.1
Node                     v24.10.0
System                   macOS (arm64)
Package Manager          npm
Output                   static
Adapter                  @astrojs/cloudflare (v13.0.0-beta.11)
Integrations             @astrojs/mdx (v5.0.0-beta.9)
                         @astrojs/sitemap (v3.7.0)

If this issue only occurs in one browser, which browser is a problem?

No response

Describe the Bug

When rendering a .astro component in an MDX file which is a part of a content collection, <style> tags do not look.

WORKAROUND if I manually add my custom component to the rendered (E.G. <Content components={{ StyledCard }} in my reproduction things start working. The branch linked in the reproduction does not have this so it is faithfully reproducing the error.

What's the expected result?

.astro components containing <style is:global... rendered in .mdx files should work.

Link to Minimal Reproducible Example

https://github.com/alexmherrmann/astro6cloudflare13-bug/tree/mdx-still-not-working

Participation

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

Metadata

Metadata

Assignees

Labels

6-betaIssues affects the beta of Astro 6

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions