mirror of
https://github.com/nuxt/nuxt.git
synced 2025-02-16 21:58:19 +00:00
fix(nuxt): allow overriding components + only warn if clash (#23156)
This commit is contained in:
parent
0612786544
commit
3e1ad3e20b
@ -140,7 +140,12 @@ export async function scanComponents (dirs: ComponentsDir[], srcDir: string): Pr
|
|||||||
const existingPriority = existingComponent.priority ?? 0
|
const existingPriority = existingComponent.priority ?? 0
|
||||||
const newPriority = component.priority ?? 0
|
const newPriority = component.priority ?? 0
|
||||||
|
|
||||||
if (newPriority >= existingPriority) {
|
// Replace component if priority is higher
|
||||||
|
if (newPriority > existingPriority) {
|
||||||
|
components.splice(components.indexOf(existingComponent), 1, component)
|
||||||
|
}
|
||||||
|
// Warn if a user-defined (or prioritised) component conflicts with a previously scanned component
|
||||||
|
if (newPriority > 0 && newPriority === existingPriority) {
|
||||||
warnAboutDuplicateComponent(componentName, filePath, existingComponent.filePath)
|
warnAboutDuplicateComponent(componentName, filePath, existingComponent.filePath)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user