-
-
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
Hoisted scripts missing in dev for content collection entry with MDX #5991
Comments
Only occurs in dev. Build + preview is fine |
@fflaten Yep, replicated and found a fix for dev. Also discovered it's overly eager in prod, and will inject scripts even without rendering with the |
Update: separating the prod build concern to a separate issue. There's a lot more to fixing that issue, and it's fairly separate from our dev server problem |
I'm having the exact same problem, even though it's supposedly fixed. For me it's the same problem in production. With |
Hey @Steffan153! Just bumped the dependencies on my minimal example, and wasn't able to replicate the issue on v2.4. If you're still hitting this, lmk your system information and a different minimal repro if you have one. |
Yes, I tried to figure out the culprit but couldn't. I created a brand new project with astro.new and there was no problem. I tried all kinds of stuff with my local project but couldn't figure it out. |
Hi, @bholmesdev! Same with @Steffan153, I think my current issue is same as this issue. I tried the above stackblitz and changed package.json to look the same as mine, with I have a I can confirm non inline script tags within the astro component works when imported to other astro components, but they do not work when it's imported to an mdx file. Another behaviour I'm noticing is that if I have the script tag to be not inline and start the dev server, it will not work, but if I change it to be inline by first part (non inline script not working) second part (declared inline, then removed, then working again) Doesn't work when built and previewed either. I've enabled the experimental assets, if that makes any difference, which I doubt because even if I change it to |
Hey @noidwasavailable! Gotcha. This sounds like a more nuanced issue than the one at the top of this issue. Since you already have a minimal repro, do you mind opening a separate issue on Astro core? |
@bholmesdev I wasn't able to create a stackblitz reproduction, but I made a repo following the minimal steps required to reproduce the issue and created a new issue here! |
What version of
astro
are you using?2.0.1
Are you using an SSR adapter? If so, which one?
None
What package manager are you using?
npm
What operating system are you using?
Mac
Describe the Bug
When using Astro components in MDX with Content Collections, hoisted scripts are ignored. Inline scripts are still present.
To reproduce:
src/content/blog/using-mdx.mdx
.Content
component for that entry usinggetCollection
orgetEntryBySlug
Link to Minimal Reproducible Example
https://stackblitz.com/edit/github-wvzeaj?file=src/components/WithHoistedScript.astro
Participation
The text was updated successfully, but these errors were encountered: