Skip to content

Commit 1e5a0db

Browse files
committed
refactor: use getGlobalThis when attachting hmr runtime
1 parent 114b856 commit 1e5a0db

File tree

1 file changed

+2
-11
lines changed
  • packages/runtime-core/src

1 file changed

+2
-11
lines changed

packages/runtime-core/src/hmr.ts

+2-11
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88
isClassComponent
99
} from './component'
1010
import { queueJob, queuePostFlushCb } from './scheduler'
11-
import { extend } from '@vue/shared'
11+
import { extend, getGlobalThis } from '@vue/shared'
1212

1313
export let isHmrUpdating = false
1414

@@ -26,16 +26,7 @@ export interface HMRRuntime {
2626
// Note: for a component to be eligible for HMR it also needs the __hmrId option
2727
// to be set so that its instances can be registered / removed.
2828
if (__DEV__) {
29-
const globalObject: any =
30-
typeof global !== 'undefined'
31-
? global
32-
: typeof self !== 'undefined'
33-
? self
34-
: typeof window !== 'undefined'
35-
? window
36-
: {}
37-
38-
globalObject.__VUE_HMR_RUNTIME__ = {
29+
getGlobalThis().__VUE_HMR_RUNTIME__ = {
3930
createRecord: tryWrap(createRecord),
4031
rerender: tryWrap(rerender),
4132
reload: tryWrap(reload)

0 commit comments

Comments
 (0)