iles
iles copied to clipboard
feat: make top-level await vue islands possible
Description 📖
Vue components using top level await in <script setup> compile to
async setup() {} components which need <Suspense> to render.
Background 📜
The Fix 🔨
By conditionally wrapping islands in <Suspense> we make it possible to use async setup hooks in island components.
☁️ Nx Cloud Report
CI is running/has finished running commands for commit 4d5a000c3a20ab00cdf633168b483b91fbcec2b7. As they complete they will appear below. Click to see the status, the terminal output, and the build insights.
📂 See all runs for this branch
✅ Successfully ran 3 targets
Sent with 💌 from NxCloud.
I like the idea of supporting async setup in islands out of the box. You can already achieve the same by wrapping manually, but this is more ergonomic.
Is Suspense tree-shakable in recent Vue builds?
If it is, it would be nice to do the wrapping at the island level, to allow tree-shaking Suspense when it's not used
If it's not, then we could simplify and always wrap the app in Suspense.
I think it should be tree-shakable. But I don't know how I can implement wrapping at the island level.