fix: HMR not working correctly with vue-class-component components #1897
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
vue-loader not registering "__hmrId" on the correct component property
when component is created with vue-class-component.
This leads to vue/compiler-sfc/runtime-core/src/render.ts mountComponent()
function to not call registerHMR() on the instance (because __hmrId is not
attached properly):
Not registering for HMR means the createRecord() map will never get injected
any component instances, so when module.hot.accept() + api.rerender(id, render)
are called they will not apply any update due to finding no instances:
This commit fixes the exportComponent from src/exportHelper.ts by injecting the
properties (__file and later down the road __hmrId) to the correct component prop:
script
reference should actually be script.__vccOpts for vue-class-component components,which is what this commit fixes.