N
Nuxt3d ago
Mobyr

Nuxt module builder is broken with components with defineEmits

Components transformed with nuxt module builder doesn't have any declared slots or events when defineEmits is use in the component. Is there a workaround ?
3 Replies
kapa.ai
kapa.ai3d ago
Hi @Mobyr. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- I'm sorry, but the knowledge sources provided do not contain explicit information about issues with Nuxt Module Builder and components using defineEmits, nor do they mention a specific workaround for the problem where components transformed with Nuxt Module Builder lack declared slots or events when defineEmits is used. However, there are related issues documented regarding defineEmits type registration and auto-imported components in Nuxt 4.1.0, where event types were not properly recognized, leading to TypeScript errors. These issues were addressed by a hotfix in Nuxt (see this GitHub issue and comments, related issue). The fix was merged in this pull request. If your issue is related to type inference or event typing in auto-imported components, updating to the latest Nuxt version (after the hotfix) may resolve it. If the problem is specifically with Nuxt Module Builder and runtime event/slot declaration, the knowledge sources do not provide a direct workaround or solution. If you need a specific workaround for Nuxt Module Builder and defineEmits, I recommend checking the latest issues and discussions on the Nuxt Module Builder GitHub repository or opening a new issue there for more targeted support, as the official documentation does not mention this scenario directly.<|source|><|source|><|source|><|source|> ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai3d ago
<@156638258573475840> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
Mobyr
MobyrOP3d ago
Volar extension also doesn't detect any props and doesn't check props type I can fix props and slots by addding a defineModel with any type but the events type will still don't exist in the .d.vue.ts/.vue.d.ts

Did you find this page helpful?