From a314697606bee4de864f4827d7825f3fdbdb3f59 Mon Sep 17 00:00:00 2001 From: Inesh Bose <56732164+ineshbose@users.noreply.github.com> Date: Sun, 21 May 2023 15:04:50 +0100 Subject: [PATCH] fix: put deprecation warning if hook in use (#2093) * docs: mention callbacks * fix: put deprecation warning if hook in use --- src/module.ts | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/module.ts b/src/module.ts index 0340a160d..4b954a675 100644 --- a/src/module.ts +++ b/src/module.ts @@ -179,11 +179,14 @@ export default defineNuxtModule({ */ // TODO: remove `i18n:extend-messages` before v8 official release - logger.warn( - '`i18n:extend-messages` is deprecated. ' + - 'That hook will be removed feature at the time of the v8 official release.\n' + - "If you're using it, please use `i18n:registerModule` instead." - ) + // @ts-ignore Property '_hooks' is private and only accessible within class 'Hookable' + if ('i18n:extend-messages' in nuxt.hooks._hooks) { + logger.warn( + '`i18n:extend-messages` is deprecated. ' + + 'That hook will be removed feature at the time of the v8 official release.\n' + + "If you're using it, please use `i18n:registerModule` instead." + ) + } const additionalMessages = await extendMessages(nuxt, localeCodes, options) /**