fix(kit): use dst to deduplicate templates when adding them (#29895)

This commit is contained in:
Gustavo Aquino Torres Teixeira 2024-11-17 08:11:00 -03:00 committed by GitHub
parent 82dc24ec0b
commit d5494c9a5a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -22,9 +22,9 @@ export function addTemplate<T> (_template: NuxtTemplate<T> | string) {
// Normalize template
const template = normalizeTemplate(_template)
// Remove any existing template with the same filename
// Remove any existing template with the same destination path
nuxt.options.build.templates = nuxt.options.build.templates
.filter(p => normalizeTemplate(p).filename !== template.filename)
.filter(p => normalizeTemplate(p).dst !== template.dst)
// Add to templates array
nuxt.options.build.templates.push(template)