fix(kit): add hooks installation for bridge (#2045)

Co-authored-by: Pooya Parsa <pyapar@gmail.com>
This commit is contained in:
Nozomu Ikuta 2021-11-21 21:35:37 +09:00 committed by GitHub
parent 4706f0877f
commit 583679f9c8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -28,8 +28,12 @@ export function defineNuxtModule<OptionsT extends ModuleOptions> (input: NuxtMod
// Install hooks // Install hooks
if (mod.hooks) { if (mod.hooks) {
if (isNuxt2(nuxt)) {
nuxt.addHooks(mod.hooks)
} else {
nuxt.hooks.addHooks(mod.hooks) nuxt.hooks.addHooks(mod.hooks)
} }
}
// Stop if no install provided // Stop if no install provided
if (typeof mod.setup !== 'function') { if (typeof mod.setup !== 'function') {