Skip to content
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 for content collection entry with MDX #8034

Closed
1 task
noidwasavailable opened this issue Aug 11, 2023 · 3 comments
Closed
1 task

Comments

@noidwasavailable
Copy link

noidwasavailable commented Aug 11, 2023

What version of astro are you using?

2.10.5

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

What browser are you using?

Chrome

Describe the Bug

Similar to issue #5991 as seen in this comment in the issue, when using Astro components in MDX with Content Collections, hoisted scripts are ignored. Inline scripts are still present (on a theme), both on dev server and on build.

Steps to reproduce

  1. Install stanaing/astro-paper
  2. Install mdx via npx astro add mdx
  3. Create an astro component with hoisted script
  4. Import above astro component in an mdx document in content/blog
  5. Run npm run dev
  6. Navigate to the mdx document created

I created a repository which goes through these steps which you can clone and just install & run.

Additional Contexts

Stackblitz seems to not be working for this repo, for which I've submitted an issue to as well...

Starting a fresh dev server reproduces this issue, but adding an is:inline directive to the concerning script then removing it, triggering hot reload, makes the issues go away, as seen in the videos below:

first part (non inline script not working)

second part (declared inline, then removed, then working again)

What's the expected result?

Non-inline <script> tags in an astro component is supposed to be hoisted and inserted into <head> of the resulting page.

Link to Minimal Reproducible Example

https://stackblitz.com/github/noidwasavailable/astropaper-mdx?file=README.md

Participation

  • I am willing to submit a pull request for this issue.
@lilnasy
Copy link
Contributor

lilnasy commented Aug 15, 2023

Thank you for submitting this issue!

Since your reproduction is not minimal, it's hard to tell what the issue is.

Do you think this might be a duplicate of #7426 and #7761?

@lilnasy lilnasy added needs response Issue needs response from OP and removed needs triage Issue needs to be triaged labels Aug 15, 2023
@noidwasavailable
Copy link
Author

@lilnasy I think it is a duplicate of #7761 because I added tried adding a script to the reproducible example in that thread like here, and pretty much seems to be the same issue as mine. I'll add further comments in that issue! Thank you.

@lilnasy
Copy link
Contributor

lilnasy commented Aug 16, 2023

Thanks for confirming!

Closing as duplicate of 7761.

@lilnasy lilnasy closed this as not planned Won't fix, can't repro, duplicate, stale Aug 16, 2023
@lilnasy lilnasy removed the needs response Issue needs response from OP label Aug 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants