diff --git a/packages/vue-i18n-core/src/utils.ts b/packages/vue-i18n-core/src/utils.ts index 52ebada4f..0ee1e9317 100644 --- a/packages/vue-i18n-core/src/utils.ts +++ b/packages/vue-i18n-core/src/utils.ts @@ -223,10 +223,10 @@ 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 + // NOTE(kazupon): avoid bundler warning + const key = 'currentInstance' + if (key in Vue) { + return (Vue as any)[key] as GenericComponentInstance | null } else { return Vue.getCurrentInstance() }