Skip to content

Commit ac341b6

Browse files
authored
fix: null element access (#879)
1 parent 8305c43 commit ac341b6

File tree

1 file changed

+11
-2
lines changed
  • packages/vue-i18n-core/src/mixins

1 file changed

+11
-2
lines changed

packages/vue-i18n-core/src/mixins/next.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,11 @@ export function defineMixin(
102102
mounted(): void {
103103
nextTick(() => {
104104
/* istanbul ignore if */
105-
if ((__DEV__ || __FEATURE_PROD_VUE_DEVTOOLS__) && !__NODE_JS__) {
105+
if (
106+
(__DEV__ || __FEATURE_PROD_VUE_DEVTOOLS__) &&
107+
!__NODE_JS__ &&
108+
this.$el
109+
) {
106110
this.$el.__VUE_I18N__ = this.$i18n.__composer
107111
const emitter: VueDevToolsEmitter = (this.__v_emitter =
108112
createEmitter<VueDevToolsEmitterEvents>())
@@ -122,7 +126,12 @@ export function defineMixin(
122126

123127
nextTick(() => {
124128
/* istanbul ignore if */
125-
if ((__DEV__ || __FEATURE_PROD_VUE_DEVTOOLS__) && !__NODE_JS__) {
129+
if (
130+
(__DEV__ || __FEATURE_PROD_VUE_DEVTOOLS__) &&
131+
!__NODE_JS__ &&
132+
this.$el &&
133+
this.$el.__VUE_I18N__
134+
) {
126135
if (this.__v_emitter) {
127136
this.__v_emitter.off('*', addTimelineEvent)
128137
delete this.__v_emitter

0 commit comments

Comments
 (0)