mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-22 05:35:13 +00:00
feat(nuxi): reload nuxt when restart
hook is called (#19084)
This commit is contained in:
parent
c7eb891e12
commit
5cfd835163
@ -38,6 +38,7 @@ Hook | Arguments | Description
|
||||
`kit:compatibility` | `compatibility, issues` | Allows extending compatibility checks.
|
||||
`ready` | `nuxt` | Called after Nuxt initialization, when the Nuxt instance is ready to work.
|
||||
`close` | `nuxt` | Called when Nuxt instance is gracefully closing.
|
||||
`restart` | - | Called to restart the current Nuxt instance. **This hook is currently only available on the [Edge Channel](/docs/guide/going-further/edge-channel/).** <!-- stabilityedge -->
|
||||
`modules:before` | - | Called during Nuxt initialization, before installing user modules.
|
||||
`modules:done` | - | Called during Nuxt initialization, after installing user modules.
|
||||
`app:resolve` | `app` | Called after resolving the `app` instance.
|
||||
|
@ -89,6 +89,8 @@ export default defineNuxtCommand({
|
||||
}
|
||||
|
||||
currentNuxt = await loadNuxt({ rootDir, dev: true, ready: false })
|
||||
currentNuxt.hooks.hookOnce('restart', () => load(true))
|
||||
|
||||
if (!isRestart) {
|
||||
showURL()
|
||||
}
|
||||
|
@ -61,7 +61,7 @@ export interface NuxtHooks {
|
||||
'kit:compatibility': (compatibility: NuxtCompatibility, issues: NuxtCompatibilityIssues) => HookResult
|
||||
|
||||
// Nuxt
|
||||
/**
|
||||
/**
|
||||
* Called after Nuxt initialization, when the Nuxt instance is ready to work.
|
||||
* @param nuxt The configured Nuxt object
|
||||
* @returns Promise
|
||||
@ -73,6 +73,11 @@ export interface NuxtHooks {
|
||||
* @returns Promise
|
||||
*/
|
||||
'close': (nuxt: Nuxt) => HookResult
|
||||
/**
|
||||
* Called to restart the current Nuxt instance.
|
||||
* @returns Promise
|
||||
*/
|
||||
'restart': () => HookResult
|
||||
|
||||
/**
|
||||
* Called during Nuxt initialization, before installing user modules.
|
||||
|
Loading…
Reference in New Issue
Block a user