fix(nuxt3): use nuxt extensions for component discovery (#1649)

This commit is contained in:
Daniel Roe 2021-11-02 15:27:42 +00:00 committed by GitHub
parent a5fcd5a976
commit 0dd86de586
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -457,7 +457,7 @@ export default {
* @version 3 * @version 3
*/ */
extensions: { extensions: {
$resolve: val => ['.js', '.mjs', '.ts', '.tsx', '.vue'].concat(val).filter(Boolean) $resolve: val => ['.js', '.jsx', '.mjs', '.ts', '.tsx', '.vue'].concat(val).filter(Boolean)
}, },
/** /**

View File

@ -26,7 +26,7 @@ export default defineNuxtModule({
const dirOptions: ComponentsDir = typeof dir === 'object' ? dir : { path: dir } const dirOptions: ComponentsDir = typeof dir === 'object' ? dir : { path: dir }
const dirPath = resolveAlias(dirOptions.path, nuxt.options.alias) const dirPath = resolveAlias(dirOptions.path, nuxt.options.alias)
const transpile = typeof dirOptions.transpile === 'boolean' ? dirOptions.transpile : 'auto' const transpile = typeof dirOptions.transpile === 'boolean' ? dirOptions.transpile : 'auto'
const extensions = dirOptions.extensions || ['vue'] // TODO: nuxt extensions and strip leading dot const extensions = (dirOptions.extensions || nuxt.options.extensions).map(e => e.replace(/^\./g, ''))
dirOptions.level = Number(dirOptions.level || 0) dirOptions.level = Number(dirOptions.level || 0)