mirror of
https://github.com/eznix86/vite-hmr.git
synced 2026-07-25 13:08:53 +00:00
A framework-agnostic Vite plugin inspired by Laravel's Vite plugin.
- TypeScript 100%
| .github/workflows | ||
| examples | ||
| .gitignore | ||
| .npmignore | ||
| biome.json | ||
| bun.lock | ||
| index.ts | ||
| LICENSE | ||
| package.json | ||
| README.md | ||
| renovate.json | ||
| tsconfig.json | ||
| vite.config.ts | ||
vite-hmr
A framework-agnostic Vite plugin inspired by Laravel's Vite plugin.
Installation
npm install vite-hmr
Usage
// vite.config.ts
import { defineConfig } from 'vite'
import hmr from 'vite-hmr'
export default defineConfig({
plugins: [
hmr({
input: ['src/js/main.ts', 'src/css/app.css'],
refresh: true,
}),
],
})
Configuration
| Option | Type | Default | Description |
|---|---|---|---|
input |
string[] | Record<string, string> |
[] |
Entry points to compile |
publicDir |
string |
"public" |
Directory for public assets |
buildDir |
string |
"build" |
Output directory inside publicDir |
hotFile |
string |
"public/hot" |
Path to hot reload file |
refresh |
boolean | string | string[] |
false |
Enable full-page reload on file changes |
Output Structure
Built files are organized into:
js/- JavaScript entry points and chunkscss/- Stylesheetsimages/- Image assetsassets/- Other assets