]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
Revert "fix(hmr): prevent __VUE_HMR_RUNTIME__ from being overwritten by vue runtime...
authoredison <daiwei521@126.com>
Wed, 24 Sep 2025 10:02:05 +0000 (18:02 +0800)
committerGitHub <noreply@github.com>
Wed, 24 Sep 2025 10:02:05 +0000 (18:02 +0800)
This reverts commit 1392734ae5d5a3b2be124753e198eafa324f6815.

packages/runtime-core/src/hmr.ts

index 8f443de0ccda268d8e56212a3bf1a92dd483ca08..4191a34f82f32e66ab08e379534a18e2cb4fff57 100644 (file)
@@ -31,17 +31,11 @@ export interface HMRRuntime {
 // 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.
 if (__DEV__) {
-  const g = getGlobalThis()
-  // vite-plugin-vue/issues/644, #13202
-  // custom-element libraries bundle Vue to simplify usage outside Vue projects but
-  // it overwrite __VUE_HMR_RUNTIME__, causing HMR to break.
-  if (!g.__VUE_HMR_RUNTIME__) {
-    g.__VUE_HMR_RUNTIME__ = {
-      createRecord: tryWrap(createRecord),
-      rerender: tryWrap(rerender),
-      reload: tryWrap(reload),
-    } as HMRRuntime
-  }
+  getGlobalThis().__VUE_HMR_RUNTIME__ = {
+    createRecord: tryWrap(createRecord),
+    rerender: tryWrap(rerender),
+    reload: tryWrap(reload),
+  } as HMRRuntime
 }
 
 const map: Map<