fix(nuxt3): respect dirs as objects (#3364)

This commit is contained in:
Daniel Roe 2022-02-24 16:20:49 +00:00 committed by GitHub
parent 34f1c510b2
commit bb31df9944
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -18,7 +18,7 @@ export default defineNuxtModule<ComponentsOptions>({
configKey: 'components'
},
defaults: {
dirs: ['~/components']
dirs: []
},
setup (componentOptions, nuxt) {
let componentDirs = []
@ -39,6 +39,15 @@ export default defineNuxtModule<ComponentsOptions>({
}))
}
}
if (dir && typeof dir === 'object') {
return {
...dir,
path: resolve(cwd, resolveAlias(dir.path, {
...nuxt.options.alias,
'~': cwd
}))
}
}
return []
}