2024-01-19 21:43:19 +00:00
|
|
|
import { addComponent, createResolver, defineNuxtModule } from 'nuxt/kit'
|
|
|
|
|
|
|
|
export default defineNuxtModule({
|
|
|
|
meta: {
|
2024-04-05 18:08:32 +00:00
|
|
|
name: 'lazy-import-components',
|
2024-01-19 21:43:19 +00:00
|
|
|
},
|
|
|
|
setup () {
|
|
|
|
const { resolve } = createResolver(import.meta.url)
|
|
|
|
|
|
|
|
addComponent({
|
|
|
|
name: 'NCompClient',
|
|
|
|
export: 'NComp',
|
|
|
|
filePath: resolve('./runtime/components'),
|
2024-04-05 18:08:32 +00:00
|
|
|
mode: 'client',
|
2024-01-19 21:43:19 +00:00
|
|
|
})
|
|
|
|
|
|
|
|
addComponent({
|
|
|
|
name: 'NCompServer',
|
|
|
|
export: 'NComp',
|
|
|
|
filePath: resolve('./runtime/components'),
|
2024-04-05 18:08:32 +00:00
|
|
|
mode: 'server',
|
2024-01-19 21:43:19 +00:00
|
|
|
})
|
|
|
|
|
|
|
|
addComponent({
|
|
|
|
name: 'NCompAll',
|
|
|
|
export: 'NComp',
|
|
|
|
filePath: resolve('./runtime/components'),
|
2024-04-05 18:08:32 +00:00
|
|
|
mode: 'all',
|
2024-01-19 21:43:19 +00:00
|
|
|
})
|
2024-04-05 18:08:32 +00:00
|
|
|
},
|
2024-01-19 21:43:19 +00:00
|
|
|
})
|