Created
January 4, 2019 03:05
-
-
Save Splinterjke/17838ba92d20e944e122c9b527cf0725 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Vue from 'vue'; | |
import upperFirst from 'lodash/upperFirst'; | |
import camelCase from 'lodash/camelCase'; | |
const requireComponent = require.context('@/components', true, /\.vue$/); | |
requireComponent.keys().forEach(fileName => { | |
const componentConfig = requireComponent(fileName); | |
const componentName = upperFirst(camelCase(fileName.replace(/^\.\//, '').replace(/\.\w+$/, ''))); | |
Vue.component(componentName, componentConfig.default || componentConfig); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment