Lazy load a Vuex module

Vuex has a registerModule method that allow us to dynamically create Vuex modules. If we take into account that import function returns a promise with the ES Module as the payload, we could use it to lazy load a module:

Conclusion

Lazy loading is made extremely simple with Vue and Webpack. Using what you’ve just read you can start splitting up your app in chunks from different sides and load them when needed, lightening the initial load of the app.