In the development environment of our project with Vite + Vue2.7 + Vuex + Vue Router, we encountered an issue where there is a circular reference between src/store/modules/user.js and src/router/index.js. Modifying any JSX code seems to cause the state of src/store referenced elsewhere (src/utils/permission.js) to be reset after HMR. We have to refresh the page, which is very bad for the development experience.
Describe the bug
In the development environment of our project with Vite + Vue2.7 + Vuex + Vue Router, we encountered an issue where there is a circular reference between
src/store/modules/user.js
andsrc/router/index.js
. Modifying any JSX code seems to cause the state ofsrc/store
referenced elsewhere (src/utils/permission.js
) to be reset after HMR. We have to refresh the page, which is very bad for the development experience.Reproduction
https://github.com/youthug/vite-vuex-state-repro.git
Steps to reproduce
src/components
folder to see the changes on the page.System Info
Used Package Manager
yarn