1👍
The question is – what do you need that for?
- To remove
import
line in a component? Use twoauto-imports
packages, see Vitesse template - To make load times faster? Vite will pack it optimally no matter if you have global components or not – I’d expect Vite to guess global components itself and pack into common-things.js
https://vuejs.org/guide/components/registration.html#local-registration
Global registration prevents build systems from removing unused components (a.k.a "tree-shaking"). If you globally register a component but end up not using it anywhere in your app, it will still be included in the final bundle.
So, I’d recommend unplugin-vue-components to make components "global" rather then actually making them global
Source:stackexchange.com