refactor: use getGlobalThis when attachting hmr runtime
This commit is contained in:
parent
114b856fd1
commit
1e5a0db4d4
@ -8,7 +8,7 @@ import {
|
|||||||
isClassComponent
|
isClassComponent
|
||||||
} from './component'
|
} from './component'
|
||||||
import { queueJob, queuePostFlushCb } from './scheduler'
|
import { queueJob, queuePostFlushCb } from './scheduler'
|
||||||
import { extend } from '@vue/shared'
|
import { extend, getGlobalThis } from '@vue/shared'
|
||||||
|
|
||||||
export let isHmrUpdating = false
|
export let isHmrUpdating = false
|
||||||
|
|
||||||
@ -26,16 +26,7 @@ export interface HMRRuntime {
|
|||||||
// Note: for a component to be eligible for HMR it also needs the __hmrId option
|
// Note: for a component to be eligible for HMR it also needs the __hmrId option
|
||||||
// to be set so that its instances can be registered / removed.
|
// to be set so that its instances can be registered / removed.
|
||||||
if (__DEV__) {
|
if (__DEV__) {
|
||||||
const globalObject: any =
|
getGlobalThis().__VUE_HMR_RUNTIME__ = {
|
||||||
typeof global !== 'undefined'
|
|
||||||
? global
|
|
||||||
: typeof self !== 'undefined'
|
|
||||||
? self
|
|
||||||
: typeof window !== 'undefined'
|
|
||||||
? window
|
|
||||||
: {}
|
|
||||||
|
|
||||||
globalObject.__VUE_HMR_RUNTIME__ = {
|
|
||||||
createRecord: tryWrap(createRecord),
|
createRecord: tryWrap(createRecord),
|
||||||
rerender: tryWrap(rerender),
|
rerender: tryWrap(rerender),
|
||||||
reload: tryWrap(reload)
|
reload: tryWrap(reload)
|
||||||
|
Loading…
Reference in New Issue
Block a user