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 Daniel Roe
parent 64a4f0711b
commit 86a7457766
No known key found for this signature in database
GPG Key ID: CBC814C393D93268

View File

@ -22,9 +22,9 @@ export function addTemplate<T> (_template: NuxtTemplate<T> | string) {
// Normalize template // Normalize template
const template = normalizeTemplate(_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 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 // Add to templates array
nuxt.options.build.templates.push(template) nuxt.options.build.templates.push(template)