Skip to content

Commit e44bb17

Browse files
committed
fix: bundle warning
1 parent 0eba0bb commit e44bb17

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

packages/vue-i18n-core/src/utils.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,11 @@ export function createTextNode(key: string): any {
215215
}
216216

217217
export function getCurrentInstance(): GenericComponentInstance | ComponentInternalInstance | null {
218-
// @ts-ignore -- NOTE(kazupon): for Vue 3.6
219-
return Vue.currentInstance || Vue.getCurrentInstance()
218+
// NOTE(kazupon): avoid bundler warning
219+
const key = 'currentInstance'
220+
if (key in Vue) {
221+
return (Vue as any)[key] as GenericComponentInstance | null
222+
} else {
223+
return Vue.getCurrentInstance()
224+
}
220225
}

0 commit comments

Comments
 (0)