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 @@ -31,11 +31,17 @@ export interface HMRRuntime {
3131// Note: for a component to be eligible for HMR it also needs the __hmrId option
3232// to be set so that its instances can be registered / removed.
3333if ( __DEV__ ) {
34- getGlobalThis ( ) . __VUE_HMR_RUNTIME__ = {
35- createRecord : tryWrap ( createRecord ) ,
36- rerender : tryWrap ( rerender ) ,
37- reload : tryWrap ( reload ) ,
38- } as HMRRuntime
34+ const g = getGlobalThis ( )
35+ // vite-plugin-vue/issues/644, #13202
36+ // custom-element libraries bundle Vue to simplify usage outside Vue projects but
37+ // it overwrite __VUE_HMR_RUNTIME__, causing HMR to break.
38+ if ( ! g . __VUE_HMR_RUNTIME__ ) {
39+ g . __VUE_HMR_RUNTIME__ = {
40+ createRecord : tryWrap ( createRecord ) ,
41+ rerender : tryWrap ( rerender ) ,
42+ reload : tryWrap ( reload ) ,
43+ } as HMRRuntime
44+ }
3945}
4046
4147const map : Map <
You can’t perform that action at this time.
0 commit comments