withastro / astro

The web framework for content-driven websites. ⭐️ Star to support our work!
https://astro.build
Other
46.88k stars 2.49k forks source link

Injected scripts not injected to injected routes #7203

Closed delucis closed 1 year ago

delucis commented 1 year ago

What version of astro are you using?

2.5.0

Are you using an SSR adapter? If so, which one?

n/a

What package manager are you using?

npm/pnpm

What operating system are you using?

macOS / Stackblitz

What browser are you using?

Firefox

Describe the Bug

Routes injected using the injectRoute integration API do not get scripts injected via the injectScript API added to them.

I’ve tested injectScript('page', '...') and injectScript('page-ssr', '...') and both are not loaded on injected routes.

The reproduction shows the same route (src/route.astro) loaded at / (via src/pages/index.astro) and at /injected (via the injectRoute API).

At /:

At /injected neither of these work.

Uncovered this here when someone tried adding the Tailwind integration to Starlight: https://github.com/withastro/starlight/issues/88

Link to Minimal Reproducible Example

https://stackblitz.com/edit/github-ssvscu?file=astro.config.mjs

Participation

andremralves commented 1 year ago

I found what is causing this issue. I'm working on a solution.