Vuex HMR setup problem
-
Hi!
I stuck trying to setup Vuex to work with HMR.
I just created new project from scratch by
quasar create
. After that, instore/index.js
, few lines from documentation added:if (process.env.DEV && module.hot) { module.hot.accept(['./module-example'], () => { const newExample = require('./module-example').default Store.hotUpdate({ modules: { example: newExample } }) }) }
But every time I update module files - nothing is happening (according to Vue DevTools). Store don’t updating. Only if I kill Quasar process in terminal and restart it.
What am I doing wrong?
P.S. No errors, HMR is working fine with SFC.
-
You shouldn’t need to add anything to get HMR with Vuex in a Quasar project. Did you add that code to the
store/index.js
file?Scott
-
Yup. I just removed that code and now store is updating after I close DevTools and open it again. Is that normal behavior? Maybe it’s DevTools issue…
-
I was wrong when expected Store state to be updated with HMR - this shouldn’t have happened. I was confused because even when I just refreshing a tab - store kept its old state. I tried to work with getters, actions, etc. and it seemed works fine. Thanks