bencodezen / vue-enterprise-boilerplate

An ever-evolving, very opinionated architecture and dev environment for new Vue SPA projects using Vue CLI.
7.77k stars 1.32k forks source link

Can you explain this file or #186

Closed ghost closed 4 years ago

ghost commented 4 years ago

https://github.com/chrisvfritz/vue-enterprise-boilerplate/blob/2b052bac9de33712e642a6477ca73643b0d25ae1/src/state/modules/index.js#L61

I don't understand what is going on here. I am trying to make something similar but HMR only works once.

joshgrib commented 4 years ago

https://github.com/chrisvfritz/vue-enterprise-boilerplate/blob/2b052bac9de33712e642a6477ca73643b0d25ae1/src/state/modules/index.js#L10-L20

This looks to me like a function to scan the file system and include any new Vuex modules that have been created or updated, so whenever the hot reloading gets triggered this makes sure it has all modules in the directory (and children), then back around the function call...

https://github.com/chrisvfritz/vue-enterprise-boilerplate/blob/2b052bac9de33712e642a6477ca73643b0d25ae1/src/state/modules/index.js#L57-L65

It updates the state with the data before the update.

Hope this helps!

chrisvfritz commented 4 years ago

Unfortunately, I can only make time to offer support for the HMR in this project (though I've added thorough comments to try to make the code easier to reuse). For additional help getting HMR working outside of this project, I recommend the Vue forum or chat.

chrisvfritz commented 4 years ago

Thanks @joshgrib for filling in to provide more info/context though!