The unplugin-vue-components library can automatically import and register PrimeVue components with the built-in resolver. Let's begin with installing the library.
Next step would be adding the PrimeVueResolver at vite.config using the Components plugin.
That's it, now the initialization code can be refactored as the following. For configuration like namespacing, visit the official documentation.