I have some components in my vue project. I don't like import loader from '@/components/someComponent1/someComponent1.vue';
because it's a lot to write and I have to repeat it for every component. So I wrote an index.js
for the components
folder:
export { default as someComponent1 } from './someComponent1/someComponent1.vue';
export { default as someComponent2 } from './someComponent2/someComponent2.vue';
...
This will allow me to import multiple components in one line:
import { someComponent1, someComponent2 } from '@/components';
My question: Is it possible that the index.js
-ish-way is slower (and even maybe bad practice) than usual imports? I wonder because doing as in the example above 'loads' the whole exported object and destructures it, which isn't the case with 'normal' imports.