import Vue from 'vue' // https://webpack.js.org/guides/dependency-management/#requirecontext const modulesFiles = require.context('./', true, /\.vue$/) // it will auto require all vuex module from modules file modulesFiles.keys().reduce((modules, modulePath) => { Vue.component(modulePath.replace(/^\.\/(.*)\.\w+$/, '$1'), modulePath) }, {})