Skip to content

Commit

Permalink
fix(vue-app): re-register components construtor in HMR (#9539)
Browse files Browse the repository at this point in the history
* fix(vue-app): re-register components construtor in HMR

* simpilify checking
  • Loading branch information
clarkdo committed Jul 12, 2021
1 parent 356de80 commit a3b2fd8
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions packages/vue-app/template/client.js
Expand Up @@ -735,6 +735,13 @@ function hotReloadAPI(_app) {
let $components = getNuxtChildComponents(_app.<%= globals.nuxt %>, [])

$components.forEach(addHotReload.bind(_app))

if (_app.context.isHMR) {
const Components = getMatchedComponents(router.currentRoute)
Components.forEach((Component) => {
Component.prototype.constructor = Component
})
}
}

function addHotReload ($component, depth) {
Expand Down

0 comments on commit a3b2fd8

Please sign in to comment.