#No hoisted script at index 0 or 1
3 messages · Page 1 of 1 (latest)
Hmm, I don't know enough to give you a confident answer yet. However, I can provide some general guidance based on the information available.
Astro uses <script> tags in a specific way. In Astro components, <script> tags are hoisted and loaded as JS modules by default. If you have included the is:inline directive or any other attribute in your tag, this default behavior is removed. If you have added any attributes to your <script> tag, you must also add the type="module" attribute to be able to use import statements. This is expected Astro behavior, as intended [source (https://docs.astro.build/en/guides/troubleshooting/#common-error-messages)].
In Astro v0.21+, a bug has been introduced that requires imports inside components to be at the top of your frontmatter [source (https://docs.astro.build/en/guides/upgrade-to/v1/#imports-on-top)].
Also, starting from v0.24, you must opt-in to <script> element processing via the hoist attribute. The type="module" is also required for hoisted modules [source (https://docs.astro.build/en/guides/upgrade-to/v1/#deprecated-script-default-processing)].
If you're still having trouble, it might be a good idea to create a GitHub issue to alert the Astro team of the problem [source (https://docs.astro.build/en/guides/troubleshooting/)].
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
@worn sandal kapa.ai is still learning and improving, please let us know how it did by reacting below