mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-22 05:35:13 +00:00
fix(nuxt): unregister hooks the moment close
is called (#27637)
This commit is contained in:
parent
cec299bdc4
commit
fda6cf7838
@ -46,10 +46,12 @@ export async function build (nuxt: Nuxt) {
|
|||||||
if (!nuxt.options._prepare) {
|
if (!nuxt.options._prepare) {
|
||||||
await Promise.all([checkForExternalConfigurationFiles(), bundle(nuxt)])
|
await Promise.all([checkForExternalConfigurationFiles(), bundle(nuxt)])
|
||||||
await nuxt.callHook('build:done')
|
await nuxt.callHook('build:done')
|
||||||
}
|
|
||||||
|
|
||||||
if (!nuxt.options.dev) {
|
if (!nuxt.options.dev) {
|
||||||
await nuxt.callHook('close', nuxt)
|
await nuxt.callHook('close', nuxt)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
nuxt.hook('prepare:types', () => nuxt.close())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,14 +49,13 @@ export function createNuxt (options: NuxtOptions): Nuxt {
|
|||||||
addHooks: hooks.addHooks,
|
addHooks: hooks.addHooks,
|
||||||
hook: hooks.hook,
|
hook: hooks.hook,
|
||||||
ready: () => initNuxt(nuxt),
|
ready: () => initNuxt(nuxt),
|
||||||
close: async () => {
|
close: () => hooks.callHook('close', nuxt),
|
||||||
await hooks.callHook('close', nuxt)
|
|
||||||
hooks.removeAllHooks()
|
|
||||||
},
|
|
||||||
vfs: {},
|
vfs: {},
|
||||||
apps: {},
|
apps: {},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
hooks.hookOnce('close', () => { hooks.removeAllHooks() })
|
||||||
|
|
||||||
return nuxt
|
return nuxt
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user