[Vuejs]-Laravel / Vue : unable to load vue component in blade tmeplate

0👍

If you shown the complete home.vue file, the script part with the export is missing:

<template>
    <div class="home">Hello from home</div>
</template>

<script>
    export default {
        name: "Home"
    }
</script>

Or it may be also related to this line:

mix.js('resources/js/app.js', 'public/js')

You should try with:

mix.js('resources/js/app.js', 'public/js').vue()

0👍

While working with Vue, make sure that following dependencies have been properly installed:

  1. VueJS (of course)
  2. vue-loader (npm i vue-loader)
  3. vue-template-compiler (npm i vue-template-compiler)

You can check those dependencies in your package.json file. If they are not there, then your SFC not going to work.

Export default is not a problem. There are compnents with just template and that’s completely fine.

Leave a comment