underfin / vite-plugin-vue2

Vue2 plugin for Vite
621 stars 84 forks source link

HMR decouples global state object on hot reload #197

Closed iamrgroot closed 2 years ago

iamrgroot commented 2 years ago

Redirected from https://github.com/vitejs/vite/issues/8027 to here.

When using global state, in my example just Vue refs with import/export, hot reloading the state and then a component using that state results in multiple decoupled states that result in outdated HTML.

Reproduction

https://github.com/IAmRGroot/reproduction-vite

Following the same steps in Vue3 (see the branch https://github.com/IAmRGroot/reproduction-vite/tree/vue3) results in correct behaviour.

iamrgroot commented 2 years ago

Fixed in Vue 2.7 👍