Closed plmrry closed 1 year ago
This also doesn't work if you pass components to child Astro components. The client:
directives only work with direct imports. This is because Astro needs to track which components are being used in the client so that it can build them all out properly.
If you import these components directly into your MDX, the client:
directives should work.
The
client:
directives only work with direct imports.
@matthewp is this documented anywhere? I'd be interested in making a docs PR if it isn't.
What version of
astro
are you using?1.9.2
Are you using an SSR adapter? If so, which one?
No
What package manager are you using?
npm
What operating system are you using?
StackBlitz
Describe the Bug
When using MDX, you can pass in custom components:
pages/index.astro
:This lets you use components in the MDX file without importing them:
data/index.mdx
:However, this breaks when you use a client directive:
data/index.mdx
:Here's the error:
Note that if you use an Astro component in MDX, and within that component you use
client:load
, it works fine.Link to Minimal Reproducible Example
https://stackblitz.com/edit/github-4i3mtk?file=src/data/index.mdx
Participation