Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix(hmr): prevent __VUE_HMR_RUNTIME__ from being overwritten by vue runtime in 3rd-party libraries #13817

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
edison1105 merged 2 commits into main from edison/fix/hmrOverride
Sep 2, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions packages/runtime-core/src/hmr.ts
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,17 @@ 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__) {
getGlobalThis().__VUE_HMR_RUNTIME__ = {
createRecord: tryWrap(createRecord),
rerender: tryWrap(rerender),
reload: tryWrap(reload),
} as HMRRuntime
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
}
}

const map: Map<
Expand Down
Loading

AltStyle によって変換されたページ (->オリジナル) /