fix(kit): allow passing a string to addLayout (#22902)

This commit is contained in:
Andrey Yolkin 2023-08-30 13:45:16 +03:00 committed by GitHub
parent ea51421768
commit aa0ea8bf2d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -6,7 +6,7 @@ import { useNuxt } from './context'
import { logger } from './logger'
import { addTemplate } from './template'
export function addLayout (this: any, template: NuxtTemplate, name?: string) {
export function addLayout (this: any, template: NuxtTemplate | string, name?: string) {
const nuxt = useNuxt()
const { filename, src } = addTemplate(template)
const layoutName = kebabCase(name || parse(filename).name).replace(/["']/g, '')