To set up a Laravel 12 project with Vue 3 using Vite, start by installing Laravel 12 via Composer with the command composer create-project --prefer-dist laravel/laravel my-laravel-app. Then, configure the environment by duplicating the .env.example file, generating an application key, and updating the .env file with database credentials. Next, install Node modules with npm install and install Vue and additional dependencies with npm install vue@latest vue-router@latest @vitejs/plugin-vue. Configure Vite for Vue by modifying the vite.config.js file.
Create a Vue app entry point by modifying resources/js/app.js and create a sample Vue component by creating resources/js/components/App.vue. Set up Vue Router by installing Vue Router and creating resources/js/router/index.js and resources/js/components/Home.vue. Update the Blade template by modifying resources/views/app.blade.php to include Vue. Finally, compile the assets using Vite with npm run dev and start the Laravel server with php artisan serve.
This setup provides a solid foundation for building scalable and high-performance web applications. You can expand your project by adding authentication, API handling, state management, and more. With this guide, you can kickstart your development journey and build modern web applications using Laravel 12 and Vue 3.
dev.to
dev.to
Create attached notes ...
