-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Await doesn't work inside of Fragments #13334
Copy link
Copy link
Closed
withastro/compiler
#1067Labels
needs triageIssue needs to be triagedIssue needs to be triaged
Description
Astro Info
Astro v5.3.0
Node v22.13.0
System Windows (x64)
Package Manager npm
Output static
Adapter none
Integrations none
If this issue only occurs in one browser, which browser is a problem?
No response
Describe the Bug
Using await inside of a <Fragment> element throws the following error message:
[ERROR] "await" can only be used inside an "async" function
For example, this markup in the <head> produces the above console error:
<Fragment>
<link
rel="preload"
href={(await import('../fonts/brown-sugar.woff2')).default}
as="font"
crossorigin
/>
</Fragment>Whereas this markup doesn't:
<link
rel="preload"
href={(await import('../fonts/brown-sugar.woff2')).default}
as="font"
crossorigin
/>This is perhaps related to this issue, but that issue seems specific to using set:html.
What's the expected result?
await should work inside of <Fragment> elements.
Link to Minimal Reproducible Example
https://stackblitz.com/edit/github-qagmg7gy?file=src%2Fpages%2Findex.astro
Participation
- I am willing to submit a pull request for this issue.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
needs triageIssue needs to be triagedIssue needs to be triaged