I have a directory structured like this.
VueTree
components
Classic.vue
Modern.vue
index.js
The Classic and Modern components consist of a template
, export default {}
, and a style
.
I am importing both of them in index.js
as:
import Classic from './components/Classic.vue'
import Modern from './components/Modern.vue'
const VueTree= {
Classic ,
Modern
}
export default VueTree
However, when I try to import the module using:
import {Classic , Modern } from '../../modules/VueTree/index.js'
I encounter the following error:
Unknown custom element: - Did you register the component correctly? For recursive components, make sure to provide the "name" option.
Although I have defined name: "Classic"
within my components and included it in the current file using components: { Classic },
, the same error persists.
It seems to only work if I export just one component like this:
import Classic from './components/Classic.vue'
import Modern from './components/Modern.vue'
export default Classic
This method works for including Classic, but I am unable to export both components simultaneously as shown in this example https://github.com/greyby/vue-spinner/blob/master/src/index.js