-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
MDX rendered by a layout does not emit CSS #7426
Comments
Hello @kurtextrem, how are you? I've seen your codesandbox and analyzed the code. I found a possible solution by adding the directive client:load to the EmbeddedTweet component. The result is as expected. Here is the link to my sandbox with the possible solution. I'm not sure if it's expected to have to add this directive to a React library, but... |
@RobertDS07 Thanks! I think this solution however makes Astros biggest benefit (not shipping JS) redundant... |
Does anyone have a hint at where to start looking if I want to fix this bug? (the work-around only partially fixes the issue: as you can see the unstyled tweet "flashes" while the assets are loading when adding |
This is an architectural limitation, I tried to provide an explanation as to why in a duplicate issue: #7761 (comment). |
This seems to be a duplicate of #7761 so I'm going to track that there. Feel free to chime in on that conversation! |
What version of
astro
are you using?2.6.5
Are you using an SSR adapter? If so, which one?
None
What package manager are you using?
yarn (and pnpm)
What operating system are you using?
Windows
What browser are you using?
Chrome
Describe the Bug
When you use a layout to render a MDX page:
(Layout.astro)
and the MDX page contains something that uses CSS modules, such as:
where
<Tweet>
is an Astro component:It does not emit the CSS modules correctly, not in
dev
and not onbuild
. See the attached codesandbox, whereindex.astro
is broken - no CSS emitted, and thenworking.astro
(/working
), the CSS is emitted correctly, because I added theTweet
component to theWorkingLayout
component. So only when you add theTweet
component to something non-MDX-related, it emits the CSS modules correctly.Link to Minimal Reproducible Example
https://codesandbox.io/p/sandbox/lingering-microservice-cz8tnn?file=%2Fsrc%2Fpages%2Findex.mdx%3A1%2C1
Participation
The text was updated successfully, but these errors were encountered: