I would like to use Vue 3 components/vue files within Blade Templates. I have been spending the whole day trying to get it working, so this is my last hope.I tried watching video tutorials, I tried reading the documentation, I have tried pretty much everything.
I first tried to install Vue using npm: npm install vue but I was told that wasn't enought; I had to use the Vue CLI in order to use components/.vue files as the CLI ships with all compilers and webpack configurations.
That's what I did:
npm install -g @vue/cli
But it didn't work, it gave me an error:
Vue command not found
So I tried using npx:
npx @vue/cli create myApp
That worked but it starts the server like a separated application, on a different url other than my Laravel app. I know that's the expected behavior and that's why I have been spending the whole day trying to find a solution.
I also tried laravel/ui but it doesn't seem to work in Laravel 8.
I tried to manually set up my Laravel+ Vue app but didn't work either:
mix.js('resources/assets/js/main.js', 'public/js');
Inside my main.js file
<script>
import {createApp} from 'vue';
import App from "./components/App.vue"
createApp(App).mount("#app");
</script>
It says that Vue could not be resolved.
My question is:
How do I use/call Vue components in my Blade Template? Any ideas will be welcome.