You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
[Bug]: Child HMR not working when parent component has HMR #11635
@tclxshunquan-wang @yuhengshen
I had dome some studies about your reproduction, but I didn't get much clue about the root cause due to i don't know much about Vue and it's compilation.
Since Vue2 is end of life more than 1 year and We don't have much bandwidth to deal Vue2's case.
And Rsbuild has a builtin Vue3 plugin, could plz have a try with that by upgrading to Vue3?
I checked it some time ago. When the hot update fails, the pulled HMR hash key is old rather than the latest one.
It might be a bug caused by the cache system.
flowchart TD
edit["Edit Child.vue <template>"] --> rebuild["Both sub-modules rebuilt"]
rebuild --> bytes["script-setup emitted bytes<br/>UNCHANGED"]
rebuild --> map["script-setup source map<br/>sourcesContent[0] = whole Child.vue<br/>CHANGED"]
bytes --> hash
map --> hash["SourceMapSource.hash<br/>folds sourcesContent into digest"]
hash --> emit["HMR ships byte-identical<br/>script-setup in hot-update.js"]
emit --> bubble["No accept handler →<br/>bubbles to SFC main wrapper"]
bubble --> reload["api.reload (not api.rerender)"]
reload --> drift["After parent HMR, record.Ctor<br/>≠ live instance Ctor"]
drift --> dom["instance.$options.render stays stale<br/>→ DOM not updated"]
style map fill:#ffe6e6
style hash fill:#ffe6e6
style dom fill:#ffcccc
Loading
vue-loader's SFC sub-modules each carry a SourceMapSource whose source map embeds the whole Child.vue as sourcesContent[0]. Hashing the source map alongside the emitted bytes means any template edit flips the codegen hash of every sibling sub-module — even when their bytes are stable.
Same bug in webpack
bundler
dev devtool
hot-update emits
child HMR
webpack
eval (default)
template only
✓
webpack
cheap-module-source-map
template + script-setup
✗
rspack
eval (override)
template only
✓
rspack
cheap-module-source-map (default)
template + script-setup
✗
webpack only escapes by default because devtool: 'eval' doesn't produce a SourceMapSource. rspack defaults to cheap-module-source-map, so the bug shows up immediately.
I drafted a fix at #14046 but decided not to land it: Vue 2 is EOL, the bug is shared with webpack under the same devtool, and the one-line config workaround is fine for the small remaining Vue 2 user base.
If you can move to Vue 3, the new __VUE_HMR_RUNTIME__ rerender path sidesteps the record.Ctor drift entirely.
Closing as wontfix with workaround. Thanks for the reproduction!
Activity
ShunquanWang commentedon Sep 11, 2025
I encountered the same problem
ShunquanWang commentedon Oct 14, 2025
When will this problem be fixed? @stormslowly
stormslowly commentedon Nov 28, 2025
@tclxshunquan-wang @yuhengshen
I had dome some studies about your reproduction, but I didn't get much clue about the root cause due to i don't know much about Vue and it's compilation.
Since Vue2 is end of life more than 1 year and We don't have much bandwidth to deal Vue2's case.
And Rsbuild has a builtin Vue3 plugin, could plz have a try with that by upgrading to Vue3?
yuhengshen commentedon Dec 1, 2025
I checked it some time ago. When the hot update fails, the pulled HMR hash key is old rather than the latest one.
It might be a bug caused by the cache system.
stormslowly commentedon May 19, 2026
Hi @yuhengshen @tclxshunquan-wang,
Going to close with a workaround. Quick rundown:
Root cause
vue-loader's SFC sub-modules each carry a
SourceMapSourcewhose source map embeds the wholeChild.vueassourcesContent[0]. Hashing the source map alongside the emitted bytes means any template edit flips the codegen hash of every sibling sub-module — even when their bytes are stable.Same bug in webpack
devtooleval(default)cheap-module-source-mapeval(override)cheap-module-source-map(default)webpack only escapes by default because
devtool: 'eval'doesn't produce aSourceMapSource. rspack defaults tocheap-module-source-map, so the bug shows up immediately.Workaround
Why not patch
I drafted a fix at #14046 but decided not to land it: Vue 2 is EOL, the bug is shared with webpack under the same
devtool, and the one-line config workaround is fine for the small remaining Vue 2 user base.If you can move to Vue 3, the new
__VUE_HMR_RUNTIME__rerender path sidesteps therecord.Ctordrift entirely.Closing as
wontfixwith workaround. Thanks for the reproduction!