fix(nuxt): don't ignore components dirs with same prefix (#6116)

This commit is contained in:
Daniel Roe 2022-07-25 11:13:54 +01:00 committed by GitHub
parent c7d072c495
commit 6c125bc941
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4,6 +4,7 @@ import { pascalCase, splitByCase } from 'scule'
import type { Component, ComponentsDir } from '@nuxt/schema' import type { Component, ComponentsDir } from '@nuxt/schema'
import { isIgnored } from '@nuxt/kit' import { isIgnored } from '@nuxt/kit'
import { hyphenate } from '@vue/shared' import { hyphenate } from '@vue/shared'
import { withTrailingSlash } from 'ufo'
/** /**
* Scan the components inside different components folders * Scan the components inside different components folders
@ -31,7 +32,7 @@ export async function scanComponents (dirs: ComponentsDir[], srcDir: string): Pr
for (const _file of files) { for (const _file of files) {
const filePath = join(dir.path, _file) const filePath = join(dir.path, _file)
if (scannedPaths.find(d => filePath.startsWith(d)) || isIgnored(filePath)) { if (scannedPaths.find(d => filePath.startsWith(withTrailingSlash(d))) || isIgnored(filePath)) {
continue continue
} }