NuxtN
Nuxt16mo 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`
          ),
      ),
    };
  }),
);


But it seems that
~
is not recognized when used outside the project. How do I implement asynchronous component import in a module?
Was this page helpful?