mirror of
https://github.com/nuxt/nuxt.git
synced 2025-01-18 01:15:58 +00:00
fix(nuxt3): hotfix for missing components declaration (#2949)
This commit is contained in:
parent
965f2abaee
commit
d20b672546
@ -65,6 +65,12 @@ export default defineNuxtModule<ComponentsOptions>({
|
||||
nuxt.hook('app:templates', async (app) => {
|
||||
components = await scanComponents(componentDirs, nuxt.options.srcDir!)
|
||||
await nuxt.callHook('components:extend', components)
|
||||
|
||||
app.templates.push({
|
||||
...componentsTypeTemplate,
|
||||
options: { components, buildDir: nuxt.options.buildDir }
|
||||
})
|
||||
|
||||
if (!components.length) {
|
||||
return
|
||||
}
|
||||
@ -74,18 +80,11 @@ export default defineNuxtModule<ComponentsOptions>({
|
||||
options: { components }
|
||||
})
|
||||
|
||||
app.templates.push({
|
||||
...componentsTypeTemplate,
|
||||
options: { components, buildDir: nuxt.options.buildDir }
|
||||
})
|
||||
|
||||
app.plugins.push({ src: '#build/components' })
|
||||
})
|
||||
|
||||
nuxt.hook('prepare:types', ({ references }) => {
|
||||
if (components.length) {
|
||||
references.push({ path: resolve(nuxt.options.buildDir, 'components.d.ts') })
|
||||
}
|
||||
references.push({ path: resolve(nuxt.options.buildDir, 'components.d.ts') })
|
||||
})
|
||||
|
||||
// Watch for changes
|
||||
|
Loading…
Reference in New Issue
Block a user