Auto-import Component from node_modules
Whichever way i try i get an error "does not provide an export named 'default' / 'string'" or the Icon Component remains unresolved.
1. The module registers.
2. Importing manually in vue works
3. I tried with and without resolver (resolve('../node_modules/@iconify/vue')),
4. I tried with import inside module and without
5. I tried with default/string export.
Code for copy paste:
import { addComponent, defineNuxtModule, createResolver } from '@nuxt/kit'
import { Icon } from '@iconify/vue';
export default defineNuxtModule({
setup() { const {resolve} = createResolver(import.meta.url) addComponent({ name: 'Icon', export: 'string', filePath: resolve('../node_modules/@iconify/vue'), global: true, }) }, })
setup() { const {resolve} = createResolver(import.meta.url) addComponent({ name: 'Icon', export: 'string', filePath: resolve('../node_modules/@iconify/vue'), global: true, }) }, })
0 Replies