In Vue 2 you can globally register components over multiple files by using the following code in index.js without bloating the main.js file
import Vue from 'vue'
import MyComponent from '@/components/MyComponent'
Vue.component('my-component-name', MyComponent)
And in the main.js file use
import '@/components'
But this method doesn't seem to work for me in Vue 3
main.js
import { createApp } from 'vue';
import '@/components'
const app = createApp({});
app.mount("#app");
index.js
import Vue from 'vue' // doesn't work with import { createApp } from 'vue' too
import MyComponent from '@/components/MyComponent'
Vue.component('my-component-name', MyComponent)
How can you achieve the same result in Vue 3?