You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Script tags with a src prop and a prop with either "true", true or {true} as the value are hidden in the build output when using a js component in the page such as a react or svelte component.
Without having gone too deep into the technical side of astro, i suspect that the issue is with rendering scripts in the SCRIPTS array created by this part of the compiler, it looks like scripts without a src prop that are passed into that array are all fine and get added to the last part of the head in the output file while scripts with a src prop never get added when a frontend framework is used in the page (More info here)
I am sure that there is much more to this bug than I have been able to find, but it looks like one of the props have to be src while the other can be named whatever you want, just as long as it has one of the values mentioned above.
Just made another stackblitz example where it shows the compiler output. Run node full-file.js to compile the full file (The file in the other stackblitz repro example) and node just-head.js to compile just the head. Hope this will be at least helpful in some way! https://stackblitz.com/edit/node-vb7wmc?file=just-head.js
I'm going to try to tackle this soon. Per withastro/roadmap#41, any attribute other than hoist should mean a <script> tag remains on the page as authored.
What version of
astro
are you using?latest
What package manager are you using?
yarn
What operating system are you using?
Windows
Describe the Bug
Script tags with a src prop and a prop with either
"true"
,true
or{true}
as the value are hidden in the build output when using a js component in the page such as a react or svelte component.Without having gone too deep into the technical side of astro, i suspect that the issue is with rendering scripts in the
SCRIPTS
array created by this part of the compiler, it looks like scripts without asrc
prop that are passed into that array are all fine and get added to the last part of the head in the output file while scripts with asrc
prop never get added when a frontend framework is used in the page (More info here)I am sure that there is much more to this bug than I have been able to find, but it looks like one of the props have to be
src
while the other can be named whatever you want, just as long as it has one of the values mentioned above.Link to Minimal Reproducible Example
https://stackblitz.com/edit/github-icwr81?file=src%2Fpages%2Findex.astro&on=stackblitz
The text was updated successfully, but these errors were encountered: