Description
Description
Component A is defined in a .vue
file, and component B is defined in a .js
file that extends A. After changing the <script>
section of A, B is reloaded but it lost what is extended (for the example below, test()
will be gone).
import Vue from 'vue'
import component from './component'
export default Vue.extend({
extends: component,
methods: {
test () { // test will be lost!
alert('test!')
}
}
})
What is expected
Component B is correctly reloaded.
Reproduction repo
https://github.com/hjkcai/vue-hot-reload-api-issue
Reproduction steps
Edit changeThis()
method or any part of the <script>
section in component.vue
. The console will show the error after hot reload.
What I have found
I tried to step into vue-hot-reload-api
to find out this question. It seems that component A and B share the same entry in the map
object, which means they have the same data ID (data-v-xxxxxx
). After hot reload, the constructor of B is recreated with the options of A. Maybe that is why component B is reloaded without its own methods?