Laravel Vite Plugin

The official Vite plugin that wires Laravel's asset pipeline into Vite's dev server and production build

Tool
npm
v3.2.1
905 stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
84 /100 Excellent
Development Activity 80
Maintenance 84
Community 76
Maturity 56
Momentum 40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
79 /100 Good
Architecture 80
Code Quality 82
Innovation 76
Learning Curve 78

Laravel Vite Plugin is the official integration layer between Laravel and Vite, replacing Laravel Mix as the framework’s default frontend build tool. It configures Vite’s dev server, hot module replacement, and manifest-based asset versioning so that Blade templates can reference compiled assets via the @vite directive without manual wiring.

Beyond basic asset compilation, the plugin handles SSR entry-point builds, TLS detection for Laravel Herd/Valet local development, Laravel Sail Docker networking, full-page reloads on Blade/route/lang file changes, and automatic self-hosted font optimization with local(), google(), bunny(), and fontsource() providers.

What You Get

  • A laravel() Vite config function that sets base path, build output directory, manifest generation, and SSR output directory from a single entry-point config or config object
  • Automatic dev-server HMR wiring, including a hot file written to the public directory so Blade’s @vite directive knows when the dev server is running
  • Built-in support for Laravel Herd/Valet HTTPS certificates and Laravel Sail’s Docker host/port configuration without extra setup
  • Full-page reload triggers on changes to Blade views, routes, language files, and Livewire components via the bundled vite-plugin-full-reload dependency
  • A fonts sub-plugin (laravel-vite-plugin/fonts) that self-hosts Google/Bunny/Fontsource fonts locally with automatic fallback-metric generation to reduce layout shift
  • An inertia-helpers subpath export with resolvePageComponent() for wiring Inertia.js page resolution into a Vite build
  • A clean-orphaned-assets CLI binary that removes stale versioned build artifacts left behind by previous builds

Common Use Cases

  • Bootstrapping the default Vite config in any Laravel 10+ application to compile resources/css/app.css and resources/js/app.js
  • Enabling SSR builds for Inertia.js applications by supplying an ssr entry point alongside the client entry
  • Self-hosting Google Fonts or other web fonts to avoid third-party font requests and improve privacy/performance scores
  • Running Laravel behind Sail, Herd, or Valet locally where the dev server needs to detect TLS certificates or bind to a Docker-accessible host
  • Triggering full-page browser reloads when editing Blade templates or Livewire components during local development

Under The Hood

Architecture The plugin’s entry point, src/index.ts, exports a default laravel() function that resolves a PluginConfig (input entries, public/build directories, hot file path, SSR options, refresh rules, TLS/font settings) and returns an array of Vite plugins: the core laravel plugin object (with config, configResolved, transform, and configureServer hooks), an asset-glob plugin, the fonts sub-plugin from src/fonts/plugin.ts, and vite-plugin-full-reload instances built from the refresh config. The core plugin’s config hook merges Laravel-specific defaults (base path, manifest output, @ resolve alias, CORS origins for *.test domains) into the user’s Vite config without overriding anything the user explicitly set, and configureServer writes a ‘hot’ file to the public directory on dev-server start so the PHP-side @vite Blade directive can detect and proxy to it.

Tech Stack Written in TypeScript targeting ES2020 with strict mode enabled, built via esbuild into ESM output with vite, vite-plugin-full-reload, picocolors, and fontaine treated as externals/peers so the published bundle stays small. Runtime dependencies are minimal (picocolors for terminal colors, tinyglobby for glob matching, vite-plugin-full-reload), and the package declares a vite@^8.0.0 peer dependency plus an optional fontaine@^0.8.0 peer for font fallback-metric generation. The bin/clean.js CLI script and inertia-helpers subpath are compiled separately via tsc.

Code Quality The project has a dedicated tests/ directory with Vitest covering the core plugin (tests/index.test.ts) and each font provider/cache/manifest/CSS-parsing module individually (nine additional test files plus fixture assets), indicating deliberate unit coverage of the trickier font-optimization logic. Source files use consistent naming, exported TypeScript interfaces for all public config shapes (PluginConfig, RefreshConfig), and JSDoc comments on every configurable option describing defaults and behavior, which keeps the single 700+-line index.ts navigable despite its size.

API Design The public API is a single default export accepting either a string, string array, or config object, which lets simple projects pass just an entry-point path while advanced projects opt into SSR, custom directories, TLS detection, and fonts through the same function. Config resolution favors sensible Laravel-convention defaults (public/, build/, manifest.json) so a new Laravel app’s vite.config.js needs only one line to get working HMR and asset versioning, and the /fonts and /inertia-helpers subpath exports keep optional features tree-shakeable and out of the core bundle.

Used by 9 apps in this directory

PHP
74%
MIT

Bagisto

Analytics · Ecommerce

28,341

Open-source Laravel eCommerce platform for building multi-vendor marketplaces, B2B stores, headless commerce, and AI-powered storefronts.

View details
94
Repo Health
75
Technical
65
Dependency
Built with
PHP 74%
Blade 21%
Updated 1 weeks ago
PHP
83%
Apache 2.0

Coolify

Devops · Hosting Control Panel

65,732

Open-source self-hosted PaaS — deploy apps, databases and 280+ services on your own servers with no vendor lock-in

View details
92
Repo Health
86
Technical
68
Dependency
Built with
PHP 83%
Blade 13%
Updated 1 weeks ago
PHP
84%
MIT

Databasement

Databases · Developer Tools · Devops

2,610

Self-hosted database backup manager with a web UI for scheduling, encrypting, and restoring MySQL, PostgreSQL, MongoDB, SQL Server, SQLite, Firebird, and Redis to S3, SFTP, Samba, or local storage.

View details
82
Repo Health
77
Technical
69
Dependency
Built with
PHP 84%
Blade 15%
Updated 1 weeks ago
PHP
59%
Other

Hi.Events

Ecommerce · Scheduling

4,135

Self-hosted event ticketing platform that keeps your attendee data, brand, and revenue completely under your control.

View details
90
Repo Health
84
Technical
67
Dependency
Built with
PHP 59%
TypeScript 36%
Updated 1 weeks ago
PHP
84%
Other

Invoice Ninja

Invoicing Finance · Project Management

10,523

Self-hostable invoicing, time-tracking, and multi-gateway payment platform for freelancers and small businesses, with built-in e-invoicing compliance for EU and global standards.

View details
95
Repo Health
83
Technical
62
Dependency
Built with
PHP 84%
Updated 1 weeks ago
PHP
52%
MIT

Krayin CRM

CRM · Ecommerce

24,118

Free, open-source Laravel & Vue.js CRM for SMEs and enterprises to manage the complete customer lifecycle.

View details
91
Repo Health
68
Technical
67
Dependency
Built with
PHP 52%
Blade 41%
Updated 1 weeks ago
Vue
49%
MIT

Mixpost

Marketing · Social Media

3,913

Self-host your own social media scheduler and publish to 11 platforms without subscriptions or data lock-in.

View details
49
Repo Health
64
Technical
71
Dependency
Built with
Vue 49%
PHP 44%
Updated 8 months ago
PHP
48%
AGPL 3.0

solidtime

Invoicing Finance · Productivity

9,114

Modern open-source time tracker for freelancers and agencies with invoicing, multi-org support, and Toggl/Clockify migration built in.

View details
84
Repo Health
81
Technical
68
Dependency
Built with
PHP 48%
TypeScript 28%
Vue 22%
Updated 1 weeks ago
PHP
72%
MIT

Yaffa

Invoicing Finance

113

Self-hosted personal finance app for long-term financial planning with AI-powered transaction parsing and investment tracking.

View details
80
Repo Health
78
Technical
67
Dependency
Built with
PHP 72%
Vue 24%
Updated 1 weeks ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers