mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-25 23:22:02 +00:00
fix(nuxt): skip scanning components that do not produce a name (#22074)
This commit is contained in:
parent
988e75bbc7
commit
e3553a36f9
@ -95,7 +95,7 @@ export async function scanComponents (dirs: ComponentsDir[], srcDir: string): Pr
|
||||
const componentName = resolveComponentName(fileName, prefixParts)
|
||||
|
||||
if (resolvedNames.has(componentName + suffix) || resolvedNames.has(componentName)) {
|
||||
console.warn(`Two component files resolving to the same name \`${componentName}\`:\n` +
|
||||
console.warn(`[nuxt] Two component files resolving to the same name \`${componentName}\`:\n` +
|
||||
`\n - ${filePath}` +
|
||||
`\n - ${resolvedNames.get(componentName)}`
|
||||
)
|
||||
@ -130,6 +130,12 @@ export async function scanComponents (dirs: ComponentsDir[], srcDir: string): Pr
|
||||
component = (await dir.extendComponent(component)) || component
|
||||
}
|
||||
|
||||
// Ignore files like `~/components/index.vue` which end up not having a name at all
|
||||
if (!componentName) {
|
||||
console.warn(`[nuxt] Component did not resolve to a file name in \`~/${relative(srcDir, filePath)}\`.`)
|
||||
continue
|
||||
}
|
||||
|
||||
// Ignore component if component is already defined (with same mode)
|
||||
if (!components.some(c => c.pascalName === component.pascalName && ['all', component.mode].includes(c.mode))) {
|
||||
components.push(component)
|
||||
|
Loading…
Reference in New Issue
Block a user