samuelmwangiw/laravel-vite

This package is abandoned and no longer maintained. No replacement package was suggested.

A tiny package that adds @vite_assets blade directive and loads Vite assets

1.4.1 2022-06-07 18:43 UTC

README

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

Since version 9.19 Laravel ships with first-party support for Vite. This package is therefore not required anymore

A tiny package that swaps out Webpack (Laravel-Mix) for Vite in you Laravel project.

This improves the developer experience by using the blazing fast Vite HMR instead of webpack compilation offered by Webpack through Laravel Mix

Installation

The easiest way to get started is on a new Laravel project.

  • Create a new project and run the following command:
 laravel new awesome-project
  cd awesome-project
  composer require laravel/jetstream
  php artisan jetstream:install inertia
   cd awesome-project
   composer require laravel/breeze --dev
   php artisan breeze:install vue
  • Then install this package via composer:
composer require --dev samuelmwangiw/laravel-vite
  • Run vite:install command to setup vite
php artisan vite:install
  • Run npm install to install the dependencies and npm run dev to start the development server
  • (Optional) Since the package publishes all assets to your App namespace during setup, it's safe to remove the package from your dependencies
composer remove --dev samuelmwangiw/laravel-vite
  • Build your amazing project

Laravel Sail

If running Sail for local development, this package provides a handy sail npm script that runs vite --host under the hood as vite is only accessible via the loopback interface (127.0.0.1) by default and would therefore not be accessible in the docker container.

npm run sail

You may optionally publish the config if you connect to the docker host running vite via a custom address/port different from http://host.docker.internal:3000

php artisan vendor:publish --provider="SamuelMwangiW\Vite\ViteServiceProvider"

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.