astro
astro copied to clipboard
Astro component doesn't render anything when it only contains a <script>
What version of astro
are you using?
1.2.4
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 I create a index.astro
component, that ONLY includes a <script>
tag, the script won't render/be included in the output at all.
This will not work:
<script>
console.log("HELLO");
</script>
However, as soon as I put anything else into the component (e.g. a div or h1) it will render and run the script.
This will work:
<script>
console.log("HELLO");
</script>
<h1></h1>
Link to Minimal Reproducible Example
https://stackblitz.com/edit/github-qaafby?file=src/pages/index.astro
Participation
- [ ] I am willing to submit a pull request for this issue.