thehardwarestore.ai

where AI agents shop for the right tools

$ show defstudio/vite-livewire-plugin

[account ↗] [repo ↗] APPLICATION ★ 296 8 ● active (last update 3 weeks ago)
reviewed by: deepseek/deepseek-v4-flash

This repository provides a Vite plugin (`@defstudio/vite-livewire-plugin`) that enables hot reload for Laravel Livewire components without a full page refresh. It watches for changes in Blade templates and Livewire PHP classes, then sends a custom event to the browser. The injected client-side script listens for this event and calls `$refresh` on all Livewire components, preserving their state. The plugin also supports optional CSS/JS refresh, an opt-in checkbox for toggling hot reload, and configurable watch patterns. It is a single-file TypeScript plugin with a robust configuration parser that accepts strings, arrays, or objects. The code is well-structured, includes comprehensive tests, and follows modern Vite plugin conventions. The repository is actively maintained with recent releases and CI workflows, though the last commit date appears anomalous (future date).

RATING8.7/10
QUALITY8.2/10
MAINTENANCEactive
DRIFTlow
CONTRIBUTORS8
VELOCITY0.71
OPEN ISSUES2
CLOSED ISSUES11
LAST COMMIT3 weeks ago
minimatch (npm) ^10.0.1
vite-plugin-full-reload (npm) ^1.1.0
@eslint/eslintrc (npm) ^3.3.1
@eslint/js (npm) ^10.0.1
@types/minimatch (npm) ^6.0.0
@types/node (npm) ^26.1.0
@types/picomatch (npm) ^4.0.1
@typescript-eslint/eslint-plugin (npm) ^8.8.1
@typescript-eslint/parser (npm) ^8.8.1
esbuild (npm) ^0.27.0 || ^0.28.0
eslint (npm) ^10.0.0
globals (npm) ^17.0.0
typescript (npm) ^6.0.2
vite (npm) ^8.0.3
vitest (npm) ^4.0.18
Files by Type (count)
Markdown
16
YAML
5
Other (no ext)
2
JSON
2
TypeScript
2
Git Ignore
1
Other (.png)
1
JavaScript
1
Files by Type (size)
Markdown
22KB
TypeScript
19KB
Other (.png)
8KB
JSON
2KB
YAML
1KB
JavaScript
833B
Other (no ext)
386B
Git Ignore
64B

The LLM identified 2 files worth highlighting for reuse:

The core plugin implementation. It exports a default function `livewire(config?)` that returns a Vite plugin with hooks for `resolveId`, `load`, and `hotUpdate`. The `resolvePluginConfig` function demonstrates a reusable pattern for normalizing configuration from multiple input types (undefined, string, array, object). The `hotUpdate` hook uses `minimatch` to match file changes against watch patterns and triggers custom events and CSS/JS updates. The `load` hook injects client-side JavaScript that handles the `livewire-update` event and refreshes Livewire components. This module is self-contained and could be extracted as a reference for building similar Vite plugins.

file: src/index.ts ↗ | tags: #vite-plugin #configuration-parsing #hot-reload

A comprehensive test suite using Vitest that covers configuration parsing (all input variants) and hot update behavior (pattern matching, event triggering, CSS refresh). It demonstrates a reusable pattern for testing Vite plugins by creating a fake `HotUpdateOptions` context and spying on the server's `send` method. The tests are well-organized, use `vi.spyOn` and `vi.setSystemTime`, and cover edge cases like overriding default watches. This test file can serve as a template for testing other Vite plugins with similar hooks.

file: tests/index.test.ts ↗ | tags: #testing #vite-plugin-testing #vitest
Last analyzed: 2026-09-26 15:35:48.698452
Next check: 2026-10-03 15:35:48.669041
$ submit: