I'm starting to use vue js in my Laravel project. I installed all packages, but my problem is when I try to call a component inside another component and I run this command :
npm run dev
I had an error from webpack.
My Code:
the parent component TabelReception.vue:
<template>
<stats-card></stats-card>
<table class="table">
<tbody>
</tbody>
</table>
</template>
<script>
import StatsCard from './StatsCard'
Vue.component('StatsCard', StatsCard)
export default {
components: {
'stats-card': StatsCard
}
}
</script>
The soon component StatsCard.vue:
<template>
<h2>
hi bro just a test
</h2>
</template>
<script>
export default {
}
</script>
app.js:
import Vue from 'vue'
/**
* The following block of code may be used to automatically register your
* Vue components. It will recursively scan this directory for the Vue
* components and automatically register them with their "basename".
*
* Eg. ./components/ExampleComponent.vue -> <example-component></example-component>
*/
// const files = require.context('./', true, /\.vue$/i)
// files.keys().map(key => Vue.component(key.split('/').pop().split('.')[0], files(key).default))
Vue.component('reception-table', require('./components/TableReception.vue').default);
Vue.component('stats-card', require('./components/StatsCard.vue').default);
/**
* Next, we will create a fresh Vue application instance and attach it to
* the page. Then, you may begin adding components to this application
* or customize the JavaScript scaffolding to fit your unique needs.
*/
const core = new Vue({
el: '#core'
});
please help .