N
Nuxt2mo ago
Skip

Nuxt 3 Modules & defineAsyncComponent

I created my own Nuxt 3 module, which i added composable to. In it, i do dynamic component imports:
return await Promise.all(
data.value.map(async (item) => {
return {
data: item,
component: defineAsyncComponent(
async () =>
await import(
`~/components//${item.attributes['component-view']}.vue`
),
),
};
}),
);
return await Promise.all(
data.value.map(async (item) => {
return {
data: item,
component: defineAsyncComponent(
async () =>
await import(
`~/components//${item.attributes['component-view']}.vue`
),
),
};
}),
);
But it seems that ~ is not recognized when used outside the project. How do I implement asynchronous component import in a module?
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server