const requireComponent_ = require.context('./', true, /index.vue$/) const obj = {} const install = function(Vue) { if (install.installed) return requireComponent_.keys().forEach(fileName => { const componentConfig = requireComponent_(fileName) const { name } = componentConfig.default if (name) { Vue.component(name, componentConfig.default || componentConfig) obj[name] = componentConfig } }) } // if (typeof window !== 'undefined' && window.Vue || Vue) { // install(window.Vue || Vue); // } // requireComponent_.keys().forEach(fileName => { // const componentConfig = requireComponent_(fileName) // const { name } = componentConfig.default // if (name) { // Vue.component(name, componentConfig.default || componentConfig) // obj[name] = componentConfig // } // }) obj.install = install export default obj