vue-components-index v1.0.17
what is this ?
this plugin will search all vue components in <vue-cli-project-root>/src/components
folder, and exports them via an automatically generated index file.
format of the index file will looks like below:
usage
since now on, you can import vue components without necessary to specify their paths. for example:
import {exampleComponent} from '@/components'
namesake conflicts
This plugin yet can not handle namesake conflicts, so if there has same name components in your project, you should not import them via the index file that generated by this plugin. Otherwise it will lead to unexpected bugs. as a fallback solution, you have to import namesake components via specify their respective paths.
install
1.download
npm i --save-dev vue-components-index
2.configure vue.config.js
note: if there has no vue.config.js file in your project root, you need to create one at first.
const VueComponentsIndex = require('vue-components-index')
module.exports = {
configureWebpack: {
plugins: [new VueComponentsIndex()]
}
}
newer version available !
the newer version of this plugin is renamed to resource-inverted-index-generator, which could generate inverted index for any type of files, not only vue.