4👍
✅
Your code should be like :
./js/app.js
require('./bootstrap');
import { createApp } from 'vue';
import components from './components';
import ExampleComponent from './components/ExampleComponent.vue'
let app=createApp(ExampleComponent)
app.use(components)
app.mount("#app")
./js/components/index.js
this is a plugin that register the components globally
import Card from './Card';
import Button from './Button';
// Components global.
export default {
install: (app, options) => {
[
Card,
Button,
].forEach(Component => {
app.component(Component.name, Component)
})
}
}
Source:stackexchange.com