Introduction
Overview
Laravel Vite is a project that aims to integrate Vite as seemlessly as possible with Laravel. It consists of three parts:
- A PHP package, which provides support for parsing Vite's manifest, Blade directives, and helper functions.
- A Vite plugin, which leverages Laravel's configuration to integrate with Vite, and provides support for SSR and multiple configurations.
- A preset, which installs Vite in a fresh Laravel project with just one command.
Traditional approach
Laravel comes with Laravel Mix, an abstraction of Webpack. It is a well-known and battle-tested bundler, but Vite takes a different approach to improve the experience of front-end development. You can learn the details on its documentation.
That means that Laravel Vite is a replacement for Laravel Mix.
Requirements
- The Laravel package requires PHP 8.0 or greater.
- The Vite plugin requires Node 16.15.1 or greater.
- Vite requires native ESM dynamic import support during development.
- The production build assumes a baseline support for native ESM via script tags. Vite does not perform any compatibility transpilation by default. Legacy browsers can be supported via the official @vitejs/plugin-legacy.