Search code examples
vue.jsvuejs3nuxt.jsnuxt3.js

Loading component doesn't show in defineAsyncComponent in Nuxt 3


Here is a minimal reproduction: https://stackblitz.com/edit/github-9ukebr-muuxch?file=pages%2Findex.vue. Basically, the component set in loadingComponent doesn't show during the loading phase. Am I doing something wrong?


Solution

  • For anyone wondering, it turns out that by default, it will not be using its own loadingComponent, which is really unexpected. Instead, it will look for the parent Suspend component's loading component. You have to add suspensible: false as an option to your defineAsyncComponent. I have updated the demo.