mirror of
https://github.com/nuxt/nuxt.git
synced 2024-12-01 18:07:22 +00:00
fix(kit): check if nuxt is restarting before updating templates (#19830)
This commit is contained in:
parent
c6f928d786
commit
824d296c7b
@ -2,7 +2,7 @@ import { existsSync } from 'node:fs'
|
|||||||
import { basename, parse, resolve } from 'pathe'
|
import { basename, parse, resolve } from 'pathe'
|
||||||
import hash from 'hash-sum'
|
import hash from 'hash-sum'
|
||||||
import type { NuxtTemplate, ResolvedNuxtTemplate } from '@nuxt/schema'
|
import type { NuxtTemplate, ResolvedNuxtTemplate } from '@nuxt/schema'
|
||||||
import { useNuxt } from './context'
|
import { useNuxt, tryUseNuxt } from './context'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Renders given template using lodash template during build into the project buildDir
|
* Renders given template using lodash template during build into the project buildDir
|
||||||
@ -77,6 +77,6 @@ export function normalizeTemplate (template: NuxtTemplate<any> | string): Resolv
|
|||||||
*
|
*
|
||||||
* You can pass a filter within the options to selectively regenerate a subset of templates.
|
* You can pass a filter within the options to selectively regenerate a subset of templates.
|
||||||
*/
|
*/
|
||||||
export function updateTemplates (options?: { filter?: (template: ResolvedNuxtTemplate<any>) => boolean }) {
|
export async function updateTemplates (options?: { filter?: (template: ResolvedNuxtTemplate<any>) => boolean }) {
|
||||||
return useNuxt().hooks.callHook('builder:generateApp', options)
|
return await tryUseNuxt()?.hooks.callHook('builder:generateApp', options)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user