How to use addComponentsDir on a pnpm workspace package in vite lib mode?

So I'm following this: https://nuxt.com/docs/guide/directory-structure/modules Loading a single component works as expected, but when adding multiple components via addComponentsDir none of the components get resolved. Does anyone have an example of using addComponentsDir? Local nuxt module:
import { defineNuxtModule, addComponentsDir, addComponent } from '@nuxt/kit'

export default defineNuxtModule({
meta: {
name: '@jcsj/peri-nuxt',
configKey:'peri-nuxt'
},
setup() {
addComponentsDir({
path: '@jcsj/peri/components',
// prefix: 'peri', //No prefix for now
watch: true,
})
// This works like in the guide
// addComponent({
// name: 'ToothModel',
// filePath: '@jcsj/peri/src/components/ToothModel.vue',
// })
// works too
// addComponent({
// name: 'MouthModel',
// filePath: '@jcsj/peri/src/components/MouthModel.vue',
// })
},
})
import { defineNuxtModule, addComponentsDir, addComponent } from '@nuxt/kit'

export default defineNuxtModule({
meta: {
name: '@jcsj/peri-nuxt',
configKey:'peri-nuxt'
},
setup() {
addComponentsDir({
path: '@jcsj/peri/components',
// prefix: 'peri', //No prefix for now
watch: true,
})
// This works like in the guide
// addComponent({
// name: 'ToothModel',
// filePath: '@jcsj/peri/src/components/ToothModel.vue',
// })
// works too
// addComponent({
// name: 'MouthModel',
// filePath: '@jcsj/peri/src/components/MouthModel.vue',
// })
},
})
Nuxt
modules/ · Nuxt Directory Structure
Use the modules/ directory to automatically register local modules within your application.
No description
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server