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.0
900stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
88/100Excellent
Development Activity88
Maintenance92
Community76
Maturity56
Momentum40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
79/100Good
Architecture80
Code Quality82
Innovation76
Learning Curve78

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 11 apps in this directory

PHP
72%
MIT

Bagisto

Analytics · Ecommerce

27,983

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

View details
93
Repo Health
75
Technical
69
Dependency
Built with
PHP72%
Blade22%
Updated today
PHP
79%
Apache 2.0

Coolify

Devops · Hosting Control Panel

60,738

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
72
Dependency
Built with
PHP79%
Blade18%
Updated yesterday
PHP
82%
MIT

Databasement

Databases · Devops · Developer Tools

1,974

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
81
Repo Health
77
Technical
69
Dependency
Built with
PHP82%
Blade17%
Updated 4 days ago
Vue
54%
GPL 3.0

Financial Freedom

Invoicing Finance

2,910

Own your financial data with a self-hosted, privacy-first budgeting app that replaces Mint and YNAB.

View details
49
Repo Health
67
Technical
75
Dependency
Built with
Vue54%
PHP44%
Updated 3 months ago
PHP
57%
Other

Hi.Events

Ecommerce · Scheduling

3,985

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

View details
88
Repo Health
84
Technical
67
Dependency
Built with
PHP57%
TypeScript37%
Updated 6 days ago
PHP
85%
Other

Invoice Ninja

Invoicing Finance · Project Management

10,008

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
97
Repo Health
83
Technical
62
Dependency
Built with
PHP85%
XSLT10%
Updated 2 days ago
PHP
51%
MIT

Krayin CRM

Ecommerce · CRM

23,694

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

View details
88
Repo Health
68
Technical
70
Dependency
Built with
PHP51%
Blade46%
Updated yesterday
Vue
49%
MIT

Mixpost

Marketing · Social Media

3,522

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

View details
51
Repo Health
64
Technical
71
Dependency
Built with
Vue49%
PHP44%
Updated 5 months ago
PHP
45%
AGPL 3.0

solidtime

Productivity · Invoicing Finance

8,860

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
70
Dependency
Built with
PHP45%
TypeScript30%
Vue23%
Updated yesterday

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

Search