File tree Expand file tree Collapse file tree 1 file changed +11
-5
lines changed
packages/runtime-core/src Expand file tree Collapse file tree 1 file changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -32,11 +32,17 @@ export interface HMRRuntime {
3232// Note: for a component to be eligible for HMR it also needs the __hmrId option
3333// to be set so that its instances can be registered / removed.
3434if ( __DEV__ ) {
35- getGlobalThis ( ) . __VUE_HMR_RUNTIME__ = {
36- createRecord : tryWrap ( createRecord ) ,
37- rerender : tryWrap ( rerender ) ,
38- reload : tryWrap ( reload ) ,
39- } as HMRRuntime
35+ const g = getGlobalThis ( )
36+ // vite-plugin-vue/issues/644, #13202
37+ // custom-element libraries bundle Vue to simplify usage outside Vue projects but
38+ // it overwrite __VUE_HMR_RUNTIME__, causing HMR to break.
39+ if ( ! g . __VUE_HMR_RUNTIME__ ) {
40+ g . __VUE_HMR_RUNTIME__ = {
41+ createRecord : tryWrap ( createRecord ) ,
42+ rerender : tryWrap ( rerender ) ,
43+ reload : tryWrap ( reload ) ,
44+ } as HMRRuntime
45+ }
4046}
4147
4248const map : Map <
You can’t perform that action at this time.
0 commit comments