DEV Community

Discussion on: Creating a Vue.js component library: Part II - Structure

Collapse
 
gerardfigols profile image
Gerard Fígols • Edited

Thanks @siegerts for this great and clear article!

Let me however add a small improvement:
In order to export multiple components from a same index.js file, the "default" reserved word shouldn't be used. Otherwise an error will be thrown:

export 'List' was not found in './ListComponents'
export 'ListItem' was not found in './ListComponents'

Overview of the changes in components/ListComponents/index.js:

"- export default { List, ListItem }"
"+ export { List, ListItem }"

Both components can be then imported in the /components/index.js file this way:

export { List, ListItem } from './ListComponents'

Source:
stackoverflow.com/questions/499825...