From 212a8524c37274b1b06fd61f1ed7ccbe5b2b4be7 Mon Sep 17 00:00:00 2001 From: kazuya kawaguchi Date: Sun, 14 Dec 2025 22:28:51 +0900 Subject: [PATCH 1/2] fix: avoid bundler warning for getCurrentInstance compatibility --- packages/vue-i18n-core/src/utils.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/packages/vue-i18n-core/src/utils.ts b/packages/vue-i18n-core/src/utils.ts index 52ebada4f..da64c7584 100644 --- a/packages/vue-i18n-core/src/utils.ts +++ b/packages/vue-i18n-core/src/utils.ts @@ -223,10 +223,9 @@ export function getCurrentInstance(): | GenericComponentInstance | ComponentInternalInstance | null { - if ('currentInstance' in Vue) { - // NOTE(kazupon): avoid bundler static analysis - const name = 'current' + 'Instance' - return (Vue as any)[name] as GenericComponentInstance | null + const key = 'currentInstance' + if (key in Vue) { + return (Vue as any)[key] as GenericComponentInstance | null } else { return Vue.getCurrentInstance() } From d0b883b9157d36746c8185c3413d8059c33bdc2e Mon Sep 17 00:00:00 2001 From: kazuya kawaguchi Date: Sun, 14 Dec 2025 22:51:56 +0900 Subject: [PATCH 2/2] fix: add comment --- packages/vue-i18n-core/src/utils.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/vue-i18n-core/src/utils.ts b/packages/vue-i18n-core/src/utils.ts index da64c7584..0ee1e9317 100644 --- a/packages/vue-i18n-core/src/utils.ts +++ b/packages/vue-i18n-core/src/utils.ts @@ -223,6 +223,7 @@ export function getCurrentInstance(): | GenericComponentInstance | ComponentInternalInstance | null { + // NOTE(kazupon): avoid bundler warning const key = 'currentInstance' if (key in Vue) { return (Vue as any)[key] as GenericComponentInstance | null